{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "a8de175a",
   "metadata": {},
   "source": [
    "# Complete Framework\n",
    "## Create the master data frame if it does not exist"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "8a4c93e9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>date</th>\n",
       "      <th>quantity</th>\n",
       "      <th>exposure</th>\n",
       "      <th>tracked_id</th>\n",
       "      <th>x</th>\n",
       "      <th>y</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>balder</td>\n",
       "      <td>10032020-25</td>\n",
       "      <td>1u</td>\n",
       "      <td>30</td>\n",
       "      <td>4</td>\n",
       "      <td>170</td>\n",
       "      <td>52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>balder</td>\n",
       "      <td>10032020-25</td>\n",
       "      <td>1u</td>\n",
       "      <td>30</td>\n",
       "      <td>4</td>\n",
       "      <td>170</td>\n",
       "      <td>51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>balder</td>\n",
       "      <td>10032020-25</td>\n",
       "      <td>1u</td>\n",
       "      <td>30</td>\n",
       "      <td>4</td>\n",
       "      <td>172</td>\n",
       "      <td>50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>balder</td>\n",
       "      <td>10032020-25</td>\n",
       "      <td>1u</td>\n",
       "      <td>30</td>\n",
       "      <td>4</td>\n",
       "      <td>170</td>\n",
       "      <td>50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>balder</td>\n",
       "      <td>10032020-25</td>\n",
       "      <td>1u</td>\n",
       "      <td>30</td>\n",
       "      <td>4</td>\n",
       "      <td>170</td>\n",
       "      <td>49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1634945</th>\n",
       "      <td>emperador</td>\n",
       "      <td>12102021-81</td>\n",
       "      <td>0</td>\n",
       "      <td>30</td>\n",
       "      <td>92</td>\n",
       "      <td>638</td>\n",
       "      <td>452</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1634946</th>\n",
       "      <td>emperador</td>\n",
       "      <td>12102021-81</td>\n",
       "      <td>0</td>\n",
       "      <td>30</td>\n",
       "      <td>92</td>\n",
       "      <td>638</td>\n",
       "      <td>451</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1634947</th>\n",
       "      <td>emperador</td>\n",
       "      <td>12102021-81</td>\n",
       "      <td>0</td>\n",
       "      <td>30</td>\n",
       "      <td>92</td>\n",
       "      <td>638</td>\n",
       "      <td>451</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1634948</th>\n",
       "      <td>emperador</td>\n",
       "      <td>12102021-81</td>\n",
       "      <td>0</td>\n",
       "      <td>30</td>\n",
       "      <td>92</td>\n",
       "      <td>638</td>\n",
       "      <td>450</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1634949</th>\n",
       "      <td>emperador</td>\n",
       "      <td>12102021-81</td>\n",
       "      <td>0</td>\n",
       "      <td>30</td>\n",
       "      <td>92</td>\n",
       "      <td>638</td>\n",
       "      <td>449</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1634950 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "              name         date quantity  exposure  tracked_id    x    y\n",
       "0           balder  10032020-25       1u        30           4  170   52\n",
       "1           balder  10032020-25       1u        30           4  170   51\n",
       "2           balder  10032020-25       1u        30           4  172   50\n",
       "3           balder  10032020-25       1u        30           4  170   50\n",
       "4           balder  10032020-25       1u        30           4  170   49\n",
       "...            ...          ...      ...       ...         ...  ...  ...\n",
       "1634945  emperador  12102021-81        0        30          92  638  452\n",
       "1634946  emperador  12102021-81        0        30          92  638  451\n",
       "1634947  emperador  12102021-81        0        30          92  638  451\n",
       "1634948  emperador  12102021-81        0        30          92  638  450\n",
       "1634949  emperador  12102021-81        0        30          92  638  449\n",
       "\n",
       "[1634950 rows x 7 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "file_path = \"traj (copy).txt\"\n",
    "\n",
    "df = pd.read_csv(file_path, names=[\"name\", \"date\", \"quantity\", \"exposure\", \"tracked_id\", \"x\", \"y\"], engine='python') \n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "5539112f",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "traj_df = pd.DataFrame({\"name\":[], \"date\":[], \"quantity\":[], \"exposure\":[], \"tracked_id\":[], \"traj\":[]})\n",
    "\n",
    "df1 = df.groupby('name')\n",
    "for k1, v1 in df1:\n",
    "    df2 = df1.get_group(k1)\n",
    "    df3 = df2.groupby('date')\n",
    "    for k3,v3 in df3:\n",
    "        df4 = df3.get_group(k3)\n",
    "        df5 = df4.groupby('quantity')\n",
    "        for k5,v5 in df5:\n",
    "            df6= df5.get_group(k5)\n",
    "            df7 = df6.groupby('exposure') \n",
    "            for k7,v7 in df7:\n",
    "                df8 = df7.get_group(k7)\n",
    "                df9 = df8.groupby('tracked_id')\n",
    "                for k9,v9 in df9:\n",
    "                    df10 = df9.get_group(k9)\n",
    "                    x = df10['x'].to_numpy()\n",
    "                    y = df10['y'].to_numpy()\n",
    "                    temp_df = pd.DataFrame({\"name\":[k1], \"date\":[k3], \"quantity\":[k5], \"exposure\":[k7], \"tracked_id\":[k9], \"traj\":[[x,y]]})\n",
    "                    traj_df = pd.concat([temp_df, traj_df], ignore_index=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dcbb3da2",
   "metadata": {},
   "source": [
    "## Read the molity results file"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "6bcdeb33",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ID1</th>\n",
       "      <th>ID2</th>\n",
       "      <th>ID3</th>\n",
       "      <th>ID4</th>\n",
       "      <th>VCL</th>\n",
       "      <th>VAP</th>\n",
       "      <th>VSL</th>\n",
       "      <th>LIN</th>\n",
       "      <th>STR</th>\n",
       "      <th>WOB</th>\n",
       "      <th>BeatCross</th>\n",
       "      <th>ALH</th>\n",
       "      <th>id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>balder</td>\n",
       "      <td>10032020-25</td>\n",
       "      <td>1u</td>\n",
       "      <td>30</td>\n",
       "      <td>127.110054</td>\n",
       "      <td>56.666355</td>\n",
       "      <td>21.805430</td>\n",
       "      <td>0.171548</td>\n",
       "      <td>0.384804</td>\n",
       "      <td>0.445805</td>\n",
       "      <td>42.413790</td>\n",
       "      <td>4.7617164</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>balder</td>\n",
       "      <td>10032020-25</td>\n",
       "      <td>1u</td>\n",
       "      <td>30</td>\n",
       "      <td>81.560410</td>\n",
       "      <td>28.683687</td>\n",
       "      <td>21.923042</td>\n",
       "      <td>0.268795</td>\n",
       "      <td>0.764304</td>\n",
       "      <td>0.351686</td>\n",
       "      <td>48.103447</td>\n",
       "      <td>2.787108</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>balder</td>\n",
       "      <td>10032020-25</td>\n",
       "      <td>1u</td>\n",
       "      <td>30</td>\n",
       "      <td>62.830067</td>\n",
       "      <td>34.478935</td>\n",
       "      <td>31.745853</td>\n",
       "      <td>0.505265</td>\n",
       "      <td>0.920732</td>\n",
       "      <td>0.548765</td>\n",
       "      <td>30.000000</td>\n",
       "      <td>2.864889</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>balder</td>\n",
       "      <td>10032020-25</td>\n",
       "      <td>1u</td>\n",
       "      <td>30</td>\n",
       "      <td>104.608300</td>\n",
       "      <td>62.548410</td>\n",
       "      <td>26.360271</td>\n",
       "      <td>0.251990</td>\n",
       "      <td>0.421438</td>\n",
       "      <td>0.597930</td>\n",
       "      <td>40.862070</td>\n",
       "      <td>4.427004</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>balder</td>\n",
       "      <td>10032020-25</td>\n",
       "      <td>1u</td>\n",
       "      <td>30</td>\n",
       "      <td>52.952248</td>\n",
       "      <td>18.416208</td>\n",
       "      <td>17.087137</td>\n",
       "      <td>0.322690</td>\n",
       "      <td>0.927831</td>\n",
       "      <td>0.347789</td>\n",
       "      <td>36.000000</td>\n",
       "      <td>2.4507627</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20800</th>\n",
       "      <td>emperador</td>\n",
       "      <td>12102021-81</td>\n",
       "      <td>0</td>\n",
       "      <td>30</td>\n",
       "      <td>79.468506</td>\n",
       "      <td>60.616825</td>\n",
       "      <td>59.321117</td>\n",
       "      <td>0.746473</td>\n",
       "      <td>0.978625</td>\n",
       "      <td>0.762778</td>\n",
       "      <td>35.492958</td>\n",
       "      <td>2.8224916</td>\n",
       "      <td>20800</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20801</th>\n",
       "      <td>emperador</td>\n",
       "      <td>12102021-81</td>\n",
       "      <td>0</td>\n",
       "      <td>30</td>\n",
       "      <td>60.739174</td>\n",
       "      <td>42.080810</td>\n",
       "      <td>41.003200</td>\n",
       "      <td>0.675070</td>\n",
       "      <td>0.974392</td>\n",
       "      <td>0.692812</td>\n",
       "      <td>42.461540</td>\n",
       "      <td>1.9754549</td>\n",
       "      <td>20801</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20802</th>\n",
       "      <td>emperador</td>\n",
       "      <td>12102021-81</td>\n",
       "      <td>0</td>\n",
       "      <td>30</td>\n",
       "      <td>76.085410</td>\n",
       "      <td>42.649494</td>\n",
       "      <td>41.026080</td>\n",
       "      <td>0.539211</td>\n",
       "      <td>0.961936</td>\n",
       "      <td>0.560548</td>\n",
       "      <td>40.000000</td>\n",
       "      <td>3.0019093</td>\n",
       "      <td>20802</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20803</th>\n",
       "      <td>emperador</td>\n",
       "      <td>12102021-81</td>\n",
       "      <td>0</td>\n",
       "      <td>30</td>\n",
       "      <td>69.032326</td>\n",
       "      <td>44.863415</td>\n",
       "      <td>43.341880</td>\n",
       "      <td>0.627849</td>\n",
       "      <td>0.966085</td>\n",
       "      <td>0.649890</td>\n",
       "      <td>29.268293</td>\n",
       "      <td>3.3641107</td>\n",
       "      <td>20803</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20804</th>\n",
       "      <td>emperador</td>\n",
       "      <td>12102021-81</td>\n",
       "      <td>0</td>\n",
       "      <td>30</td>\n",
       "      <td>113.997505</td>\n",
       "      <td>88.041760</td>\n",
       "      <td>84.100840</td>\n",
       "      <td>0.737743</td>\n",
       "      <td>0.955238</td>\n",
       "      <td>0.772313</td>\n",
       "      <td>13.333333</td>\n",
       "      <td>4.5584183</td>\n",
       "      <td>20804</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20805 rows × 13 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             ID1          ID2 ID3  ID4         VCL        VAP        VSL  \\\n",
       "0         balder  10032020-25  1u   30  127.110054  56.666355  21.805430   \n",
       "1         balder  10032020-25  1u   30   81.560410  28.683687  21.923042   \n",
       "2         balder  10032020-25  1u   30   62.830067  34.478935  31.745853   \n",
       "3         balder  10032020-25  1u   30  104.608300  62.548410  26.360271   \n",
       "4         balder  10032020-25  1u   30   52.952248  18.416208  17.087137   \n",
       "...          ...          ...  ..  ...         ...        ...        ...   \n",
       "20800  emperador  12102021-81   0   30   79.468506  60.616825  59.321117   \n",
       "20801  emperador  12102021-81   0   30   60.739174  42.080810  41.003200   \n",
       "20802  emperador  12102021-81   0   30   76.085410  42.649494  41.026080   \n",
       "20803  emperador  12102021-81   0   30   69.032326  44.863415  43.341880   \n",
       "20804  emperador  12102021-81   0   30  113.997505  88.041760  84.100840   \n",
       "\n",
       "            LIN       STR       WOB  BeatCross        ALH     id  \n",
       "0      0.171548  0.384804  0.445805  42.413790  4.7617164      0  \n",
       "1      0.268795  0.764304  0.351686  48.103447   2.787108      1  \n",
       "2      0.505265  0.920732  0.548765  30.000000   2.864889      2  \n",
       "3      0.251990  0.421438  0.597930  40.862070   4.427004      3  \n",
       "4      0.322690  0.927831  0.347789  36.000000  2.4507627      4  \n",
       "...         ...       ...       ...        ...        ...    ...  \n",
       "20800  0.746473  0.978625  0.762778  35.492958  2.8224916  20800  \n",
       "20801  0.675070  0.974392  0.692812  42.461540  1.9754549  20801  \n",
       "20802  0.539211  0.961936  0.560548  40.000000  3.0019093  20802  \n",
       "20803  0.627849  0.966085  0.649890  29.268293  3.3641107  20803  \n",
       "20804  0.737743  0.955238  0.772313  13.333333  4.5584183  20804  \n",
       "\n",
       "[20805 rows x 13 columns]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mr_df = pd.read_csv(\"Motility_Results.txt\", engine='python') \n",
    "id_ = [x for x in range(20805)]\n",
    "mr_df[\"id\"] = id_\n",
    "mr_df "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9191eaae",
   "metadata": {},
   "source": [
    "## Sort the data frames"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "e6a9d317",
   "metadata": {},
   "outputs": [],
   "source": [
    "traj_df = traj_df.sort_values(by=['name', 'date', 'quantity', 'exposure', 'tracked_id']) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "65514382",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>date</th>\n",
       "      <th>quantity</th>\n",
       "      <th>exposure</th>\n",
       "      <th>tracked_id</th>\n",
       "      <th>traj</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>20804</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>[[69, 70, 71, 71, 72, 73, 73, 74, 75, 76, 76, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20803</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>[[209, 208, 210, 210, 211, 212, 212, 214, 214,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20802</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>[[166, 166, 166, 166, 166, 166, 165, 165, 164,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20801</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>[[153, 152, 151, 151, 150, 149, 149, 149, 148,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20800</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>[[101, 100, 100, 100, 100, 92, 91, 91, 92, 91,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>[[1, 2, 3, 4, 4, 6, 7, 8, 8, 10, 11, 12, 12, 1...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>290.0</td>\n",
       "      <td>[[407, 406, 407, 404, 403, 402, 401, 401, 401,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>291.0</td>\n",
       "      <td>[[200, 201, 200, 202, 202, 202, 203, 203, 203,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>293.0</td>\n",
       "      <td>[[182, 181, 181, 180, 181, 181, 180, 181, 180,...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>295.0</td>\n",
       "      <td>[[270, 271, 271, 271, 272, 272, 272, 272, 273,...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20805 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         name         date quantity  exposure  tracked_id  \\\n",
       "20804  balder  01062021-25        0       0.0         1.0   \n",
       "20803  balder  01062021-25        0       0.0         3.0   \n",
       "20802  balder  01062021-25        0       0.0         4.0   \n",
       "20801  balder  01062021-25        0       0.0         6.0   \n",
       "20800  balder  01062021-25        0       0.0         7.0   \n",
       "...       ...          ...      ...       ...         ...   \n",
       "4        loki   10032020-9        0       0.0       287.0   \n",
       "3        loki   10032020-9        0       0.0       290.0   \n",
       "2        loki   10032020-9        0       0.0       291.0   \n",
       "1        loki   10032020-9        0       0.0       293.0   \n",
       "0        loki   10032020-9        0       0.0       295.0   \n",
       "\n",
       "                                                    traj  \n",
       "20804  [[69, 70, 71, 71, 72, 73, 73, 74, 75, 76, 76, ...  \n",
       "20803  [[209, 208, 210, 210, 211, 212, 212, 214, 214,...  \n",
       "20802  [[166, 166, 166, 166, 166, 166, 165, 165, 164,...  \n",
       "20801  [[153, 152, 151, 151, 150, 149, 149, 149, 148,...  \n",
       "20800  [[101, 100, 100, 100, 100, 92, 91, 91, 92, 91,...  \n",
       "...                                                  ...  \n",
       "4      [[1, 2, 3, 4, 4, 6, 7, 8, 8, 10, 11, 12, 12, 1...  \n",
       "3      [[407, 406, 407, 404, 403, 402, 401, 401, 401,...  \n",
       "2      [[200, 201, 200, 202, 202, 202, 203, 203, 203,...  \n",
       "1      [[182, 181, 181, 180, 181, 181, 180, 181, 180,...  \n",
       "0      [[270, 271, 271, 271, 272, 272, 272, 272, 273,...  \n",
       "\n",
       "[20805 rows x 6 columns]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "traj_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "1a8eda61",
   "metadata": {},
   "outputs": [],
   "source": [
    "mr_df = mr_df.sort_values(by=['ID1', 'ID2', 'ID3', 'ID4', 'id'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "642bc31d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ID1</th>\n",
       "      <th>ID2</th>\n",
       "      <th>ID3</th>\n",
       "      <th>ID4</th>\n",
       "      <th>VCL</th>\n",
       "      <th>VAP</th>\n",
       "      <th>VSL</th>\n",
       "      <th>LIN</th>\n",
       "      <th>STR</th>\n",
       "      <th>WOB</th>\n",
       "      <th>BeatCross</th>\n",
       "      <th>ALH</th>\n",
       "      <th>id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>6194</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>79.959810</td>\n",
       "      <td>65.180660</td>\n",
       "      <td>60.576260</td>\n",
       "      <td>0.757584</td>\n",
       "      <td>0.929359</td>\n",
       "      <td>0.815168</td>\n",
       "      <td>30.000000</td>\n",
       "      <td>4.276645</td>\n",
       "      <td>6194</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6195</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>89.038410</td>\n",
       "      <td>47.606697</td>\n",
       "      <td>44.321228</td>\n",
       "      <td>0.497777</td>\n",
       "      <td>0.930987</td>\n",
       "      <td>0.534676</td>\n",
       "      <td>44.482758</td>\n",
       "      <td>3.3122602</td>\n",
       "      <td>6195</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6196</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>55.782050</td>\n",
       "      <td>39.061245</td>\n",
       "      <td>37.602840</td>\n",
       "      <td>0.674103</td>\n",
       "      <td>0.962664</td>\n",
       "      <td>0.700248</td>\n",
       "      <td>33.846153</td>\n",
       "      <td>2.2061138</td>\n",
       "      <td>6196</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6197</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>61.317635</td>\n",
       "      <td>50.661057</td>\n",
       "      <td>48.099777</td>\n",
       "      <td>0.784436</td>\n",
       "      <td>0.949443</td>\n",
       "      <td>0.826207</td>\n",
       "      <td>36.585365</td>\n",
       "      <td>3.6620018</td>\n",
       "      <td>6197</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6198</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>92.437790</td>\n",
       "      <td>31.140326</td>\n",
       "      <td>24.251595</td>\n",
       "      <td>0.262356</td>\n",
       "      <td>0.778784</td>\n",
       "      <td>0.336879</td>\n",
       "      <td>21.600000</td>\n",
       "      <td>2.8383772</td>\n",
       "      <td>6198</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3646</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>96.704130</td>\n",
       "      <td>64.950470</td>\n",
       "      <td>59.788445</td>\n",
       "      <td>0.618262</td>\n",
       "      <td>0.920524</td>\n",
       "      <td>0.671641</td>\n",
       "      <td>26.470589</td>\n",
       "      <td>3.6918447</td>\n",
       "      <td>3646</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3647</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>120.385190</td>\n",
       "      <td>59.779380</td>\n",
       "      <td>54.945923</td>\n",
       "      <td>0.456418</td>\n",
       "      <td>0.919145</td>\n",
       "      <td>0.496568</td>\n",
       "      <td>28.000000</td>\n",
       "      <td>3.6505616</td>\n",
       "      <td>3647</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3648</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>58.640600</td>\n",
       "      <td>30.063608</td>\n",
       "      <td>27.091166</td>\n",
       "      <td>0.461986</td>\n",
       "      <td>0.901128</td>\n",
       "      <td>0.512676</td>\n",
       "      <td>23.571428</td>\n",
       "      <td>2.008077</td>\n",
       "      <td>3648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3649</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>68.929520</td>\n",
       "      <td>18.630800</td>\n",
       "      <td>17.365812</td>\n",
       "      <td>0.251936</td>\n",
       "      <td>0.932102</td>\n",
       "      <td>0.270288</td>\n",
       "      <td>32.142857</td>\n",
       "      <td>2.827821</td>\n",
       "      <td>3649</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3650</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>57.033836</td>\n",
       "      <td>35.512478</td>\n",
       "      <td>33.005080</td>\n",
       "      <td>0.578693</td>\n",
       "      <td>0.929394</td>\n",
       "      <td>0.622656</td>\n",
       "      <td>23.076923</td>\n",
       "      <td>2.561492</td>\n",
       "      <td>3650</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20805 rows × 13 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         ID1          ID2 ID3  ID4         VCL        VAP        VSL  \\\n",
       "6194  balder  01062021-25   0    0   79.959810  65.180660  60.576260   \n",
       "6195  balder  01062021-25   0    0   89.038410  47.606697  44.321228   \n",
       "6196  balder  01062021-25   0    0   55.782050  39.061245  37.602840   \n",
       "6197  balder  01062021-25   0    0   61.317635  50.661057  48.099777   \n",
       "6198  balder  01062021-25   0    0   92.437790  31.140326  24.251595   \n",
       "...      ...          ...  ..  ...         ...        ...        ...   \n",
       "3646    loki   10032020-9   0    0   96.704130  64.950470  59.788445   \n",
       "3647    loki   10032020-9   0    0  120.385190  59.779380  54.945923   \n",
       "3648    loki   10032020-9   0    0   58.640600  30.063608  27.091166   \n",
       "3649    loki   10032020-9   0    0   68.929520  18.630800  17.365812   \n",
       "3650    loki   10032020-9   0    0   57.033836  35.512478  33.005080   \n",
       "\n",
       "           LIN       STR       WOB  BeatCross        ALH    id  \n",
       "6194  0.757584  0.929359  0.815168  30.000000   4.276645  6194  \n",
       "6195  0.497777  0.930987  0.534676  44.482758  3.3122602  6195  \n",
       "6196  0.674103  0.962664  0.700248  33.846153  2.2061138  6196  \n",
       "6197  0.784436  0.949443  0.826207  36.585365  3.6620018  6197  \n",
       "6198  0.262356  0.778784  0.336879  21.600000  2.8383772  6198  \n",
       "...        ...       ...       ...        ...        ...   ...  \n",
       "3646  0.618262  0.920524  0.671641  26.470589  3.6918447  3646  \n",
       "3647  0.456418  0.919145  0.496568  28.000000  3.6505616  3647  \n",
       "3648  0.461986  0.901128  0.512676  23.571428   2.008077  3648  \n",
       "3649  0.251936  0.932102  0.270288  32.142857   2.827821  3649  \n",
       "3650  0.578693  0.929394  0.622656  23.076923   2.561492  3650  \n",
       "\n",
       "[20805 rows x 13 columns]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mr_df"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5eb7c014",
   "metadata": {},
   "source": [
    "## Create the master data frame"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "a43edbee",
   "metadata": {},
   "outputs": [],
   "source": [
    "traj_name_list = traj_df[\"name\"].values.tolist()\n",
    "traj_date_list = traj_df[\"date\"].values.tolist()\n",
    "traj_quantity_list = traj_df[\"quantity\"].values.tolist()\n",
    "traj_exposure_list = traj_df[\"exposure\"].values.tolist()\n",
    "traj_tracked_id_list = traj_df[\"tracked_id\"].values.tolist()\n",
    "traj_traj_list = traj_df[\"traj\"].values.tolist()\n",
    "mr_VCL_list = mr_df[\"VCL\"].values.tolist()\n",
    "mr_VAP_list = mr_df[\"VAP\"].values.tolist()\n",
    "mr_VSL_list = mr_df[\"VSL\"].values.tolist()\n",
    "mr_LIN_list = mr_df[\"LIN\"].values.tolist()\n",
    "mr_STR_list = mr_df[\"STR\"].values.tolist()\n",
    "mr_WOB_list = mr_df[\"WOB\"].values.tolist()\n",
    "mr_BeatCross_list = mr_df[\"BeatCross\"].values.tolist()\n",
    "mr_ALH_list = mr_df[\"ALH\"].values.tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "40a9128a",
   "metadata": {},
   "outputs": [],
   "source": [
    "master_dict = {\"name\":traj_name_list, \"date\":traj_date_list, \"quantity\":traj_quantity_list, \n",
    "               \"exposure\":traj_exposure_list, \"tracked_id\":traj_tracked_id_list, \"traj\":traj_traj_list,\n",
    "              \"VCL\":mr_VCL_list, \"VAP\":mr_VAP_list, \"VSL\":mr_VSL_list, \"LIN\":mr_LIN_list, \"STR\":mr_STR_list,\n",
    "              \"WOB\":mr_WOB_list, \"BeatCross\":mr_BeatCross_list, \"ALH\":mr_ALH_list}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "6041f2bd",
   "metadata": {},
   "outputs": [],
   "source": [
    "master_df = pd.DataFrame(master_dict)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "557e1587",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>date</th>\n",
       "      <th>quantity</th>\n",
       "      <th>exposure</th>\n",
       "      <th>tracked_id</th>\n",
       "      <th>traj</th>\n",
       "      <th>VCL</th>\n",
       "      <th>VAP</th>\n",
       "      <th>VSL</th>\n",
       "      <th>LIN</th>\n",
       "      <th>STR</th>\n",
       "      <th>WOB</th>\n",
       "      <th>BeatCross</th>\n",
       "      <th>ALH</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>[[69, 70, 71, 71, 72, 73, 73, 74, 75, 76, 76, ...</td>\n",
       "      <td>79.959810</td>\n",
       "      <td>65.180660</td>\n",
       "      <td>60.576260</td>\n",
       "      <td>0.757584</td>\n",
       "      <td>0.929359</td>\n",
       "      <td>0.815168</td>\n",
       "      <td>30.000000</td>\n",
       "      <td>4.276645</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>[[209, 208, 210, 210, 211, 212, 212, 214, 214,...</td>\n",
       "      <td>89.038410</td>\n",
       "      <td>47.606697</td>\n",
       "      <td>44.321228</td>\n",
       "      <td>0.497777</td>\n",
       "      <td>0.930987</td>\n",
       "      <td>0.534676</td>\n",
       "      <td>44.482758</td>\n",
       "      <td>3.3122602</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>[[166, 166, 166, 166, 166, 166, 165, 165, 164,...</td>\n",
       "      <td>55.782050</td>\n",
       "      <td>39.061245</td>\n",
       "      <td>37.602840</td>\n",
       "      <td>0.674103</td>\n",
       "      <td>0.962664</td>\n",
       "      <td>0.700248</td>\n",
       "      <td>33.846153</td>\n",
       "      <td>2.2061138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>[[153, 152, 151, 151, 150, 149, 149, 149, 148,...</td>\n",
       "      <td>61.317635</td>\n",
       "      <td>50.661057</td>\n",
       "      <td>48.099777</td>\n",
       "      <td>0.784436</td>\n",
       "      <td>0.949443</td>\n",
       "      <td>0.826207</td>\n",
       "      <td>36.585365</td>\n",
       "      <td>3.6620018</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>[[101, 100, 100, 100, 100, 92, 91, 91, 92, 91,...</td>\n",
       "      <td>92.437790</td>\n",
       "      <td>31.140326</td>\n",
       "      <td>24.251595</td>\n",
       "      <td>0.262356</td>\n",
       "      <td>0.778784</td>\n",
       "      <td>0.336879</td>\n",
       "      <td>21.600000</td>\n",
       "      <td>2.8383772</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20800</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>[[1, 2, 3, 4, 4, 6, 7, 8, 8, 10, 11, 12, 12, 1...</td>\n",
       "      <td>96.704130</td>\n",
       "      <td>64.950470</td>\n",
       "      <td>59.788445</td>\n",
       "      <td>0.618262</td>\n",
       "      <td>0.920524</td>\n",
       "      <td>0.671641</td>\n",
       "      <td>26.470589</td>\n",
       "      <td>3.6918447</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20801</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>290.0</td>\n",
       "      <td>[[407, 406, 407, 404, 403, 402, 401, 401, 401,...</td>\n",
       "      <td>120.385190</td>\n",
       "      <td>59.779380</td>\n",
       "      <td>54.945923</td>\n",
       "      <td>0.456418</td>\n",
       "      <td>0.919145</td>\n",
       "      <td>0.496568</td>\n",
       "      <td>28.000000</td>\n",
       "      <td>3.6505616</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20802</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>291.0</td>\n",
       "      <td>[[200, 201, 200, 202, 202, 202, 203, 203, 203,...</td>\n",
       "      <td>58.640600</td>\n",
       "      <td>30.063608</td>\n",
       "      <td>27.091166</td>\n",
       "      <td>0.461986</td>\n",
       "      <td>0.901128</td>\n",
       "      <td>0.512676</td>\n",
       "      <td>23.571428</td>\n",
       "      <td>2.008077</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20803</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>293.0</td>\n",
       "      <td>[[182, 181, 181, 180, 181, 181, 180, 181, 180,...</td>\n",
       "      <td>68.929520</td>\n",
       "      <td>18.630800</td>\n",
       "      <td>17.365812</td>\n",
       "      <td>0.251936</td>\n",
       "      <td>0.932102</td>\n",
       "      <td>0.270288</td>\n",
       "      <td>32.142857</td>\n",
       "      <td>2.827821</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20804</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>295.0</td>\n",
       "      <td>[[270, 271, 271, 271, 272, 272, 272, 272, 273,...</td>\n",
       "      <td>57.033836</td>\n",
       "      <td>35.512478</td>\n",
       "      <td>33.005080</td>\n",
       "      <td>0.578693</td>\n",
       "      <td>0.929394</td>\n",
       "      <td>0.622656</td>\n",
       "      <td>23.076923</td>\n",
       "      <td>2.561492</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20805 rows × 14 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         name         date quantity  exposure  tracked_id  \\\n",
       "0      balder  01062021-25        0       0.0         1.0   \n",
       "1      balder  01062021-25        0       0.0         3.0   \n",
       "2      balder  01062021-25        0       0.0         4.0   \n",
       "3      balder  01062021-25        0       0.0         6.0   \n",
       "4      balder  01062021-25        0       0.0         7.0   \n",
       "...       ...          ...      ...       ...         ...   \n",
       "20800    loki   10032020-9        0       0.0       287.0   \n",
       "20801    loki   10032020-9        0       0.0       290.0   \n",
       "20802    loki   10032020-9        0       0.0       291.0   \n",
       "20803    loki   10032020-9        0       0.0       293.0   \n",
       "20804    loki   10032020-9        0       0.0       295.0   \n",
       "\n",
       "                                                    traj         VCL  \\\n",
       "0      [[69, 70, 71, 71, 72, 73, 73, 74, 75, 76, 76, ...   79.959810   \n",
       "1      [[209, 208, 210, 210, 211, 212, 212, 214, 214,...   89.038410   \n",
       "2      [[166, 166, 166, 166, 166, 166, 165, 165, 164,...   55.782050   \n",
       "3      [[153, 152, 151, 151, 150, 149, 149, 149, 148,...   61.317635   \n",
       "4      [[101, 100, 100, 100, 100, 92, 91, 91, 92, 91,...   92.437790   \n",
       "...                                                  ...         ...   \n",
       "20800  [[1, 2, 3, 4, 4, 6, 7, 8, 8, 10, 11, 12, 12, 1...   96.704130   \n",
       "20801  [[407, 406, 407, 404, 403, 402, 401, 401, 401,...  120.385190   \n",
       "20802  [[200, 201, 200, 202, 202, 202, 203, 203, 203,...   58.640600   \n",
       "20803  [[182, 181, 181, 180, 181, 181, 180, 181, 180,...   68.929520   \n",
       "20804  [[270, 271, 271, 271, 272, 272, 272, 272, 273,...   57.033836   \n",
       "\n",
       "             VAP        VSL       LIN       STR       WOB  BeatCross  \\\n",
       "0      65.180660  60.576260  0.757584  0.929359  0.815168  30.000000   \n",
       "1      47.606697  44.321228  0.497777  0.930987  0.534676  44.482758   \n",
       "2      39.061245  37.602840  0.674103  0.962664  0.700248  33.846153   \n",
       "3      50.661057  48.099777  0.784436  0.949443  0.826207  36.585365   \n",
       "4      31.140326  24.251595  0.262356  0.778784  0.336879  21.600000   \n",
       "...          ...        ...       ...       ...       ...        ...   \n",
       "20800  64.950470  59.788445  0.618262  0.920524  0.671641  26.470589   \n",
       "20801  59.779380  54.945923  0.456418  0.919145  0.496568  28.000000   \n",
       "20802  30.063608  27.091166  0.461986  0.901128  0.512676  23.571428   \n",
       "20803  18.630800  17.365812  0.251936  0.932102  0.270288  32.142857   \n",
       "20804  35.512478  33.005080  0.578693  0.929394  0.622656  23.076923   \n",
       "\n",
       "             ALH  \n",
       "0       4.276645  \n",
       "1      3.3122602  \n",
       "2      2.2061138  \n",
       "3      3.6620018  \n",
       "4      2.8383772  \n",
       "...          ...  \n",
       "20800  3.6918447  \n",
       "20801  3.6505616  \n",
       "20802   2.008077  \n",
       "20803   2.827821  \n",
       "20804   2.561492  \n",
       "\n",
       "[20805 rows x 14 columns]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "master_df"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "879cae4d",
   "metadata": {},
   "source": [
    "# Generate the images\n",
    "## Warning: run this section only once"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "6322d002",
   "metadata": {},
   "outputs": [],
   "source": [
    "traj_list = master_df['traj'].values.tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "958afad6",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "\n",
    "def center_of_traj(x, y):\n",
    "    max_x = np.amax(x)\n",
    "    min_x = np.amin(x)\n",
    "    max_y = np.amax(y)\n",
    "    min_y = np.amin(y)\n",
    "    x_c = np.mean([max_x, min_x])\n",
    "    y_c = np.mean([max_y, min_y])\n",
    "    return x_c, y_c "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "1f9992b1",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "20805it [04:53, 70.95it/s] \n"
     ]
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "from PIL import Image\n",
    "from tqdm import tqdm\n",
    "import numpy as np\n",
    "from numpy import asarray\n",
    "\n",
    "window_size = 60\n",
    "list_arrays = []\n",
    "for index, traj in tqdm(enumerate(traj_list)):\n",
    "    list_x, list_y = zip(traj)\n",
    "    x = np.asarray(list_x).squeeze()\n",
    "    y = np.asarray(list_y).squeeze()\n",
    "    c = range(len(x)) #arange numpy\n",
    "    x_c, y_c = center_of_traj(x, y)\n",
    "    plt.figure(figsize=[2,2])\n",
    "    plt.plot(x, y, 'k')\n",
    "    plt.xlim([x_c - window_size/2, x_c + window_size/2])\n",
    "    plt.ylim([y_c - window_size/2, y_c + window_size/2])\n",
    "    plt.gca().set_aspect('equal', adjustable='box')\n",
    "    plt.axis('off')\n",
    "    new_id = '{:05d}'.format(index)\n",
    "    plt.savefig(f'img_08052022/{new_id}.png')\n",
    "    plt.close()\n",
    "    img = Image.open(f'img_08052022/{new_id}.png').convert('L')\n",
    "    numpydata = asarray(img).flatten()/255\n",
    "    list_arrays.append(numpydata)\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "6eeabdee",
   "metadata": {},
   "outputs": [],
   "source": [
    "master_df['img'] = list_arrays"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "2a9c9374",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>date</th>\n",
       "      <th>quantity</th>\n",
       "      <th>exposure</th>\n",
       "      <th>tracked_id</th>\n",
       "      <th>traj</th>\n",
       "      <th>VCL</th>\n",
       "      <th>VAP</th>\n",
       "      <th>VSL</th>\n",
       "      <th>LIN</th>\n",
       "      <th>STR</th>\n",
       "      <th>WOB</th>\n",
       "      <th>BeatCross</th>\n",
       "      <th>ALH</th>\n",
       "      <th>img</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>[[69, 70, 71, 71, 72, 73, 73, 74, 75, 76, 76, ...</td>\n",
       "      <td>79.959810</td>\n",
       "      <td>65.180660</td>\n",
       "      <td>60.576260</td>\n",
       "      <td>0.757584</td>\n",
       "      <td>0.929359</td>\n",
       "      <td>0.815168</td>\n",
       "      <td>30.000000</td>\n",
       "      <td>4.276645</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>[[209, 208, 210, 210, 211, 212, 212, 214, 214,...</td>\n",
       "      <td>89.038410</td>\n",
       "      <td>47.606697</td>\n",
       "      <td>44.321228</td>\n",
       "      <td>0.497777</td>\n",
       "      <td>0.930987</td>\n",
       "      <td>0.534676</td>\n",
       "      <td>44.482758</td>\n",
       "      <td>3.3122602</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>[[166, 166, 166, 166, 166, 166, 165, 165, 164,...</td>\n",
       "      <td>55.782050</td>\n",
       "      <td>39.061245</td>\n",
       "      <td>37.602840</td>\n",
       "      <td>0.674103</td>\n",
       "      <td>0.962664</td>\n",
       "      <td>0.700248</td>\n",
       "      <td>33.846153</td>\n",
       "      <td>2.2061138</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>[[153, 152, 151, 151, 150, 149, 149, 149, 148,...</td>\n",
       "      <td>61.317635</td>\n",
       "      <td>50.661057</td>\n",
       "      <td>48.099777</td>\n",
       "      <td>0.784436</td>\n",
       "      <td>0.949443</td>\n",
       "      <td>0.826207</td>\n",
       "      <td>36.585365</td>\n",
       "      <td>3.6620018</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>[[101, 100, 100, 100, 100, 92, 91, 91, 92, 91,...</td>\n",
       "      <td>92.437790</td>\n",
       "      <td>31.140326</td>\n",
       "      <td>24.251595</td>\n",
       "      <td>0.262356</td>\n",
       "      <td>0.778784</td>\n",
       "      <td>0.336879</td>\n",
       "      <td>21.600000</td>\n",
       "      <td>2.8383772</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20800</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>[[1, 2, 3, 4, 4, 6, 7, 8, 8, 10, 11, 12, 12, 1...</td>\n",
       "      <td>96.704130</td>\n",
       "      <td>64.950470</td>\n",
       "      <td>59.788445</td>\n",
       "      <td>0.618262</td>\n",
       "      <td>0.920524</td>\n",
       "      <td>0.671641</td>\n",
       "      <td>26.470589</td>\n",
       "      <td>3.6918447</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20801</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>290.0</td>\n",
       "      <td>[[407, 406, 407, 404, 403, 402, 401, 401, 401,...</td>\n",
       "      <td>120.385190</td>\n",
       "      <td>59.779380</td>\n",
       "      <td>54.945923</td>\n",
       "      <td>0.456418</td>\n",
       "      <td>0.919145</td>\n",
       "      <td>0.496568</td>\n",
       "      <td>28.000000</td>\n",
       "      <td>3.6505616</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20802</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>291.0</td>\n",
       "      <td>[[200, 201, 200, 202, 202, 202, 203, 203, 203,...</td>\n",
       "      <td>58.640600</td>\n",
       "      <td>30.063608</td>\n",
       "      <td>27.091166</td>\n",
       "      <td>0.461986</td>\n",
       "      <td>0.901128</td>\n",
       "      <td>0.512676</td>\n",
       "      <td>23.571428</td>\n",
       "      <td>2.008077</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20803</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>293.0</td>\n",
       "      <td>[[182, 181, 181, 180, 181, 181, 180, 181, 180,...</td>\n",
       "      <td>68.929520</td>\n",
       "      <td>18.630800</td>\n",
       "      <td>17.365812</td>\n",
       "      <td>0.251936</td>\n",
       "      <td>0.932102</td>\n",
       "      <td>0.270288</td>\n",
       "      <td>32.142857</td>\n",
       "      <td>2.827821</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20804</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>295.0</td>\n",
       "      <td>[[270, 271, 271, 271, 272, 272, 272, 272, 273,...</td>\n",
       "      <td>57.033836</td>\n",
       "      <td>35.512478</td>\n",
       "      <td>33.005080</td>\n",
       "      <td>0.578693</td>\n",
       "      <td>0.929394</td>\n",
       "      <td>0.622656</td>\n",
       "      <td>23.076923</td>\n",
       "      <td>2.561492</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20805 rows × 15 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         name         date quantity  exposure  tracked_id  \\\n",
       "0      balder  01062021-25        0       0.0         1.0   \n",
       "1      balder  01062021-25        0       0.0         3.0   \n",
       "2      balder  01062021-25        0       0.0         4.0   \n",
       "3      balder  01062021-25        0       0.0         6.0   \n",
       "4      balder  01062021-25        0       0.0         7.0   \n",
       "...       ...          ...      ...       ...         ...   \n",
       "20800    loki   10032020-9        0       0.0       287.0   \n",
       "20801    loki   10032020-9        0       0.0       290.0   \n",
       "20802    loki   10032020-9        0       0.0       291.0   \n",
       "20803    loki   10032020-9        0       0.0       293.0   \n",
       "20804    loki   10032020-9        0       0.0       295.0   \n",
       "\n",
       "                                                    traj         VCL  \\\n",
       "0      [[69, 70, 71, 71, 72, 73, 73, 74, 75, 76, 76, ...   79.959810   \n",
       "1      [[209, 208, 210, 210, 211, 212, 212, 214, 214,...   89.038410   \n",
       "2      [[166, 166, 166, 166, 166, 166, 165, 165, 164,...   55.782050   \n",
       "3      [[153, 152, 151, 151, 150, 149, 149, 149, 148,...   61.317635   \n",
       "4      [[101, 100, 100, 100, 100, 92, 91, 91, 92, 91,...   92.437790   \n",
       "...                                                  ...         ...   \n",
       "20800  [[1, 2, 3, 4, 4, 6, 7, 8, 8, 10, 11, 12, 12, 1...   96.704130   \n",
       "20801  [[407, 406, 407, 404, 403, 402, 401, 401, 401,...  120.385190   \n",
       "20802  [[200, 201, 200, 202, 202, 202, 203, 203, 203,...   58.640600   \n",
       "20803  [[182, 181, 181, 180, 181, 181, 180, 181, 180,...   68.929520   \n",
       "20804  [[270, 271, 271, 271, 272, 272, 272, 272, 273,...   57.033836   \n",
       "\n",
       "             VAP        VSL       LIN       STR       WOB  BeatCross  \\\n",
       "0      65.180660  60.576260  0.757584  0.929359  0.815168  30.000000   \n",
       "1      47.606697  44.321228  0.497777  0.930987  0.534676  44.482758   \n",
       "2      39.061245  37.602840  0.674103  0.962664  0.700248  33.846153   \n",
       "3      50.661057  48.099777  0.784436  0.949443  0.826207  36.585365   \n",
       "4      31.140326  24.251595  0.262356  0.778784  0.336879  21.600000   \n",
       "...          ...        ...       ...       ...       ...        ...   \n",
       "20800  64.950470  59.788445  0.618262  0.920524  0.671641  26.470589   \n",
       "20801  59.779380  54.945923  0.456418  0.919145  0.496568  28.000000   \n",
       "20802  30.063608  27.091166  0.461986  0.901128  0.512676  23.571428   \n",
       "20803  18.630800  17.365812  0.251936  0.932102  0.270288  32.142857   \n",
       "20804  35.512478  33.005080  0.578693  0.929394  0.622656  23.076923   \n",
       "\n",
       "             ALH                                                img  \n",
       "0       4.276645  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...  \n",
       "1      3.3122602  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...  \n",
       "2      2.2061138  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...  \n",
       "3      3.6620018  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...  \n",
       "4      2.8383772  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...  \n",
       "...          ...                                                ...  \n",
       "20800  3.6918447  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...  \n",
       "20801  3.6505616  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...  \n",
       "20802   2.008077  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...  \n",
       "20803   2.827821  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...  \n",
       "20804   2.561492  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...  \n",
       "\n",
       "[20805 rows x 15 columns]"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "master_df"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "30960935",
   "metadata": {},
   "source": [
    "## Save the master data frame"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "33c1d4d5",
   "metadata": {},
   "outputs": [],
   "source": [
    "master_df.to_pickle(\"master_08052022.pkl\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4be5f7e1",
   "metadata": {},
   "source": [
    "## Load the master data frame if it already exists"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a08a5ed0",
   "metadata": {},
   "outputs": [],
   "source": [
    "master_df = pd.read_pickle(\"master_08052022.pkl\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bf5e6215",
   "metadata": {},
   "source": [
    "## Generate the labels"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "8812d10d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0 0 4 ... 2 2 4]\n"
     ]
    }
   ],
   "source": [
    "import sklearn.cluster as cluster\n",
    "kClusters = 6\n",
    "y_labels = cluster.AgglomerativeClustering(kClusters).fit_predict(list_arrays)\n",
    "\n",
    "print(y_labels)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "fbba694c",
   "metadata": {},
   "outputs": [],
   "source": [
    "master_df['cluster'] = y_labels"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "7388e28a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>date</th>\n",
       "      <th>quantity</th>\n",
       "      <th>exposure</th>\n",
       "      <th>tracked_id</th>\n",
       "      <th>traj</th>\n",
       "      <th>VCL</th>\n",
       "      <th>VAP</th>\n",
       "      <th>VSL</th>\n",
       "      <th>LIN</th>\n",
       "      <th>STR</th>\n",
       "      <th>WOB</th>\n",
       "      <th>BeatCross</th>\n",
       "      <th>ALH</th>\n",
       "      <th>img</th>\n",
       "      <th>cluster</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>[[69, 70, 71, 71, 72, 73, 73, 74, 75, 76, 76, ...</td>\n",
       "      <td>79.959810</td>\n",
       "      <td>65.180660</td>\n",
       "      <td>60.576260</td>\n",
       "      <td>0.757584</td>\n",
       "      <td>0.929359</td>\n",
       "      <td>0.815168</td>\n",
       "      <td>30.000000</td>\n",
       "      <td>4.276645</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>[[209, 208, 210, 210, 211, 212, 212, 214, 214,...</td>\n",
       "      <td>89.038410</td>\n",
       "      <td>47.606697</td>\n",
       "      <td>44.321228</td>\n",
       "      <td>0.497777</td>\n",
       "      <td>0.930987</td>\n",
       "      <td>0.534676</td>\n",
       "      <td>44.482758</td>\n",
       "      <td>3.3122602</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>[[166, 166, 166, 166, 166, 166, 165, 165, 164,...</td>\n",
       "      <td>55.782050</td>\n",
       "      <td>39.061245</td>\n",
       "      <td>37.602840</td>\n",
       "      <td>0.674103</td>\n",
       "      <td>0.962664</td>\n",
       "      <td>0.700248</td>\n",
       "      <td>33.846153</td>\n",
       "      <td>2.2061138</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>[[153, 152, 151, 151, 150, 149, 149, 149, 148,...</td>\n",
       "      <td>61.317635</td>\n",
       "      <td>50.661057</td>\n",
       "      <td>48.099777</td>\n",
       "      <td>0.784436</td>\n",
       "      <td>0.949443</td>\n",
       "      <td>0.826207</td>\n",
       "      <td>36.585365</td>\n",
       "      <td>3.6620018</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>[[101, 100, 100, 100, 100, 92, 91, 91, 92, 91,...</td>\n",
       "      <td>92.437790</td>\n",
       "      <td>31.140326</td>\n",
       "      <td>24.251595</td>\n",
       "      <td>0.262356</td>\n",
       "      <td>0.778784</td>\n",
       "      <td>0.336879</td>\n",
       "      <td>21.600000</td>\n",
       "      <td>2.8383772</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20800</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>[[1, 2, 3, 4, 4, 6, 7, 8, 8, 10, 11, 12, 12, 1...</td>\n",
       "      <td>96.704130</td>\n",
       "      <td>64.950470</td>\n",
       "      <td>59.788445</td>\n",
       "      <td>0.618262</td>\n",
       "      <td>0.920524</td>\n",
       "      <td>0.671641</td>\n",
       "      <td>26.470589</td>\n",
       "      <td>3.6918447</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20801</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>290.0</td>\n",
       "      <td>[[407, 406, 407, 404, 403, 402, 401, 401, 401,...</td>\n",
       "      <td>120.385190</td>\n",
       "      <td>59.779380</td>\n",
       "      <td>54.945923</td>\n",
       "      <td>0.456418</td>\n",
       "      <td>0.919145</td>\n",
       "      <td>0.496568</td>\n",
       "      <td>28.000000</td>\n",
       "      <td>3.6505616</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20802</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>291.0</td>\n",
       "      <td>[[200, 201, 200, 202, 202, 202, 203, 203, 203,...</td>\n",
       "      <td>58.640600</td>\n",
       "      <td>30.063608</td>\n",
       "      <td>27.091166</td>\n",
       "      <td>0.461986</td>\n",
       "      <td>0.901128</td>\n",
       "      <td>0.512676</td>\n",
       "      <td>23.571428</td>\n",
       "      <td>2.008077</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20803</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>293.0</td>\n",
       "      <td>[[182, 181, 181, 180, 181, 181, 180, 181, 180,...</td>\n",
       "      <td>68.929520</td>\n",
       "      <td>18.630800</td>\n",
       "      <td>17.365812</td>\n",
       "      <td>0.251936</td>\n",
       "      <td>0.932102</td>\n",
       "      <td>0.270288</td>\n",
       "      <td>32.142857</td>\n",
       "      <td>2.827821</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20804</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>295.0</td>\n",
       "      <td>[[270, 271, 271, 271, 272, 272, 272, 272, 273,...</td>\n",
       "      <td>57.033836</td>\n",
       "      <td>35.512478</td>\n",
       "      <td>33.005080</td>\n",
       "      <td>0.578693</td>\n",
       "      <td>0.929394</td>\n",
       "      <td>0.622656</td>\n",
       "      <td>23.076923</td>\n",
       "      <td>2.561492</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20805 rows × 16 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         name         date quantity  exposure  tracked_id  \\\n",
       "0      balder  01062021-25        0       0.0         1.0   \n",
       "1      balder  01062021-25        0       0.0         3.0   \n",
       "2      balder  01062021-25        0       0.0         4.0   \n",
       "3      balder  01062021-25        0       0.0         6.0   \n",
       "4      balder  01062021-25        0       0.0         7.0   \n",
       "...       ...          ...      ...       ...         ...   \n",
       "20800    loki   10032020-9        0       0.0       287.0   \n",
       "20801    loki   10032020-9        0       0.0       290.0   \n",
       "20802    loki   10032020-9        0       0.0       291.0   \n",
       "20803    loki   10032020-9        0       0.0       293.0   \n",
       "20804    loki   10032020-9        0       0.0       295.0   \n",
       "\n",
       "                                                    traj         VCL  \\\n",
       "0      [[69, 70, 71, 71, 72, 73, 73, 74, 75, 76, 76, ...   79.959810   \n",
       "1      [[209, 208, 210, 210, 211, 212, 212, 214, 214,...   89.038410   \n",
       "2      [[166, 166, 166, 166, 166, 166, 165, 165, 164,...   55.782050   \n",
       "3      [[153, 152, 151, 151, 150, 149, 149, 149, 148,...   61.317635   \n",
       "4      [[101, 100, 100, 100, 100, 92, 91, 91, 92, 91,...   92.437790   \n",
       "...                                                  ...         ...   \n",
       "20800  [[1, 2, 3, 4, 4, 6, 7, 8, 8, 10, 11, 12, 12, 1...   96.704130   \n",
       "20801  [[407, 406, 407, 404, 403, 402, 401, 401, 401,...  120.385190   \n",
       "20802  [[200, 201, 200, 202, 202, 202, 203, 203, 203,...   58.640600   \n",
       "20803  [[182, 181, 181, 180, 181, 181, 180, 181, 180,...   68.929520   \n",
       "20804  [[270, 271, 271, 271, 272, 272, 272, 272, 273,...   57.033836   \n",
       "\n",
       "             VAP        VSL       LIN       STR       WOB  BeatCross  \\\n",
       "0      65.180660  60.576260  0.757584  0.929359  0.815168  30.000000   \n",
       "1      47.606697  44.321228  0.497777  0.930987  0.534676  44.482758   \n",
       "2      39.061245  37.602840  0.674103  0.962664  0.700248  33.846153   \n",
       "3      50.661057  48.099777  0.784436  0.949443  0.826207  36.585365   \n",
       "4      31.140326  24.251595  0.262356  0.778784  0.336879  21.600000   \n",
       "...          ...        ...       ...       ...       ...        ...   \n",
       "20800  64.950470  59.788445  0.618262  0.920524  0.671641  26.470589   \n",
       "20801  59.779380  54.945923  0.456418  0.919145  0.496568  28.000000   \n",
       "20802  30.063608  27.091166  0.461986  0.901128  0.512676  23.571428   \n",
       "20803  18.630800  17.365812  0.251936  0.932102  0.270288  32.142857   \n",
       "20804  35.512478  33.005080  0.578693  0.929394  0.622656  23.076923   \n",
       "\n",
       "             ALH                                                img  cluster  \n",
       "0       4.276645  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        0  \n",
       "1      3.3122602  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        0  \n",
       "2      2.2061138  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        4  \n",
       "3      3.6620018  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        0  \n",
       "4      2.8383772  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        2  \n",
       "...          ...                                                ...      ...  \n",
       "20800  3.6918447  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        0  \n",
       "20801  3.6505616  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        4  \n",
       "20802   2.008077  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        2  \n",
       "20803   2.827821  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        2  \n",
       "20804   2.561492  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        4  \n",
       "\n",
       "[20805 rows x 16 columns]"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "master_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "e9080d8e",
   "metadata": {},
   "outputs": [],
   "source": [
    "master_df.to_pickle(\"master_08052022.pkl\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d0c7e14c",
   "metadata": {},
   "source": [
    "## Load the data frames if they are not stored in the memory"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "171319dd",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "master_df = pd.read_pickle(\"master_08052022.pkl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "64b25817",
   "metadata": {},
   "outputs": [],
   "source": [
    "list_images = master_df[\"img\"].values.tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "bf3f79f8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>date</th>\n",
       "      <th>quantity</th>\n",
       "      <th>exposure</th>\n",
       "      <th>tracked_id</th>\n",
       "      <th>traj</th>\n",
       "      <th>VCL</th>\n",
       "      <th>VAP</th>\n",
       "      <th>VSL</th>\n",
       "      <th>LIN</th>\n",
       "      <th>STR</th>\n",
       "      <th>WOB</th>\n",
       "      <th>BeatCross</th>\n",
       "      <th>ALH</th>\n",
       "      <th>img</th>\n",
       "      <th>cluster</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>[[69, 70, 71, 71, 72, 73, 73, 74, 75, 76, 76, ...</td>\n",
       "      <td>79.959810</td>\n",
       "      <td>65.180660</td>\n",
       "      <td>60.576260</td>\n",
       "      <td>0.757584</td>\n",
       "      <td>0.929359</td>\n",
       "      <td>0.815168</td>\n",
       "      <td>30.000000</td>\n",
       "      <td>4.276645</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>[[209, 208, 210, 210, 211, 212, 212, 214, 214,...</td>\n",
       "      <td>89.038410</td>\n",
       "      <td>47.606697</td>\n",
       "      <td>44.321228</td>\n",
       "      <td>0.497777</td>\n",
       "      <td>0.930987</td>\n",
       "      <td>0.534676</td>\n",
       "      <td>44.482758</td>\n",
       "      <td>3.3122602</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>[[166, 166, 166, 166, 166, 166, 165, 165, 164,...</td>\n",
       "      <td>55.782050</td>\n",
       "      <td>39.061245</td>\n",
       "      <td>37.602840</td>\n",
       "      <td>0.674103</td>\n",
       "      <td>0.962664</td>\n",
       "      <td>0.700248</td>\n",
       "      <td>33.846153</td>\n",
       "      <td>2.2061138</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>[[153, 152, 151, 151, 150, 149, 149, 149, 148,...</td>\n",
       "      <td>61.317635</td>\n",
       "      <td>50.661057</td>\n",
       "      <td>48.099777</td>\n",
       "      <td>0.784436</td>\n",
       "      <td>0.949443</td>\n",
       "      <td>0.826207</td>\n",
       "      <td>36.585365</td>\n",
       "      <td>3.6620018</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>[[101, 100, 100, 100, 100, 92, 91, 91, 92, 91,...</td>\n",
       "      <td>92.437790</td>\n",
       "      <td>31.140326</td>\n",
       "      <td>24.251595</td>\n",
       "      <td>0.262356</td>\n",
       "      <td>0.778784</td>\n",
       "      <td>0.336879</td>\n",
       "      <td>21.600000</td>\n",
       "      <td>2.8383772</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20800</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>[[1, 2, 3, 4, 4, 6, 7, 8, 8, 10, 11, 12, 12, 1...</td>\n",
       "      <td>96.704130</td>\n",
       "      <td>64.950470</td>\n",
       "      <td>59.788445</td>\n",
       "      <td>0.618262</td>\n",
       "      <td>0.920524</td>\n",
       "      <td>0.671641</td>\n",
       "      <td>26.470589</td>\n",
       "      <td>3.6918447</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20801</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>290.0</td>\n",
       "      <td>[[407, 406, 407, 404, 403, 402, 401, 401, 401,...</td>\n",
       "      <td>120.385190</td>\n",
       "      <td>59.779380</td>\n",
       "      <td>54.945923</td>\n",
       "      <td>0.456418</td>\n",
       "      <td>0.919145</td>\n",
       "      <td>0.496568</td>\n",
       "      <td>28.000000</td>\n",
       "      <td>3.6505616</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20802</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>291.0</td>\n",
       "      <td>[[200, 201, 200, 202, 202, 202, 203, 203, 203,...</td>\n",
       "      <td>58.640600</td>\n",
       "      <td>30.063608</td>\n",
       "      <td>27.091166</td>\n",
       "      <td>0.461987</td>\n",
       "      <td>0.901128</td>\n",
       "      <td>0.512676</td>\n",
       "      <td>23.571428</td>\n",
       "      <td>2.008077</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20803</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>293.0</td>\n",
       "      <td>[[182, 181, 181, 180, 181, 181, 180, 181, 180,...</td>\n",
       "      <td>68.929520</td>\n",
       "      <td>18.630800</td>\n",
       "      <td>17.365812</td>\n",
       "      <td>0.251936</td>\n",
       "      <td>0.932102</td>\n",
       "      <td>0.270288</td>\n",
       "      <td>32.142857</td>\n",
       "      <td>2.827821</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20804</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>295.0</td>\n",
       "      <td>[[270, 271, 271, 271, 272, 272, 272, 272, 273,...</td>\n",
       "      <td>57.033836</td>\n",
       "      <td>35.512478</td>\n",
       "      <td>33.005080</td>\n",
       "      <td>0.578693</td>\n",
       "      <td>0.929394</td>\n",
       "      <td>0.622656</td>\n",
       "      <td>23.076923</td>\n",
       "      <td>2.561492</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20805 rows × 16 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         name         date quantity  exposure  tracked_id  \\\n",
       "0      balder  01062021-25        0       0.0         1.0   \n",
       "1      balder  01062021-25        0       0.0         3.0   \n",
       "2      balder  01062021-25        0       0.0         4.0   \n",
       "3      balder  01062021-25        0       0.0         6.0   \n",
       "4      balder  01062021-25        0       0.0         7.0   \n",
       "...       ...          ...      ...       ...         ...   \n",
       "20800    loki   10032020-9        0       0.0       287.0   \n",
       "20801    loki   10032020-9        0       0.0       290.0   \n",
       "20802    loki   10032020-9        0       0.0       291.0   \n",
       "20803    loki   10032020-9        0       0.0       293.0   \n",
       "20804    loki   10032020-9        0       0.0       295.0   \n",
       "\n",
       "                                                    traj         VCL  \\\n",
       "0      [[69, 70, 71, 71, 72, 73, 73, 74, 75, 76, 76, ...   79.959810   \n",
       "1      [[209, 208, 210, 210, 211, 212, 212, 214, 214,...   89.038410   \n",
       "2      [[166, 166, 166, 166, 166, 166, 165, 165, 164,...   55.782050   \n",
       "3      [[153, 152, 151, 151, 150, 149, 149, 149, 148,...   61.317635   \n",
       "4      [[101, 100, 100, 100, 100, 92, 91, 91, 92, 91,...   92.437790   \n",
       "...                                                  ...         ...   \n",
       "20800  [[1, 2, 3, 4, 4, 6, 7, 8, 8, 10, 11, 12, 12, 1...   96.704130   \n",
       "20801  [[407, 406, 407, 404, 403, 402, 401, 401, 401,...  120.385190   \n",
       "20802  [[200, 201, 200, 202, 202, 202, 203, 203, 203,...   58.640600   \n",
       "20803  [[182, 181, 181, 180, 181, 181, 180, 181, 180,...   68.929520   \n",
       "20804  [[270, 271, 271, 271, 272, 272, 272, 272, 273,...   57.033836   \n",
       "\n",
       "             VAP        VSL       LIN       STR       WOB  BeatCross  \\\n",
       "0      65.180660  60.576260  0.757584  0.929359  0.815168  30.000000   \n",
       "1      47.606697  44.321228  0.497777  0.930987  0.534676  44.482758   \n",
       "2      39.061245  37.602840  0.674103  0.962664  0.700248  33.846153   \n",
       "3      50.661057  48.099777  0.784436  0.949443  0.826207  36.585365   \n",
       "4      31.140326  24.251595  0.262356  0.778784  0.336879  21.600000   \n",
       "...          ...        ...       ...       ...       ...        ...   \n",
       "20800  64.950470  59.788445  0.618262  0.920524  0.671641  26.470589   \n",
       "20801  59.779380  54.945923  0.456418  0.919145  0.496568  28.000000   \n",
       "20802  30.063608  27.091166  0.461987  0.901128  0.512676  23.571428   \n",
       "20803  18.630800  17.365812  0.251936  0.932102  0.270288  32.142857   \n",
       "20804  35.512478  33.005080  0.578693  0.929394  0.622656  23.076923   \n",
       "\n",
       "             ALH                                                img  cluster  \n",
       "0       4.276645  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        0  \n",
       "1      3.3122602  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        0  \n",
       "2      2.2061138  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        4  \n",
       "3      3.6620018  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        0  \n",
       "4      2.8383772  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        2  \n",
       "...          ...                                                ...      ...  \n",
       "20800  3.6918447  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        0  \n",
       "20801  3.6505616  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        4  \n",
       "20802   2.008077  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        2  \n",
       "20803   2.827821  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        2  \n",
       "20804   2.561492  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        4  \n",
       "\n",
       "[20805 rows x 16 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "master_df"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2c182d7b",
   "metadata": {},
   "source": [
    "## Generate the subplots if they are not already generated"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "9ac5d06e",
   "metadata": {},
   "outputs": [],
   "source": [
    "cluster_0 = master_df[master_df[\"cluster\"]==0]\n",
    "cluster_1 = master_df[master_df[\"cluster\"]==1]\n",
    "cluster_2 = master_df[master_df[\"cluster\"]==2]\n",
    "cluster_3 = master_df[master_df[\"cluster\"]==3]\n",
    "cluster_4 = master_df[master_df[\"cluster\"]==4]\n",
    "cluster_5 = master_df[master_df[\"cluster\"]==5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "469f1bfe-2ee5-4841-8c16-15dab19cd7ea",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4868\n",
      "3843\n",
      "3891\n",
      "2267\n",
      "3442\n",
      "2494\n"
     ]
    }
   ],
   "source": [
    "#cluster\n",
    "print(len(cluster_0))\n",
    "print(len(cluster_1))\n",
    "print(len(cluster_2))\n",
    "print(len(cluster_3))\n",
    "print(len(cluster_4))\n",
    "print(len(cluster_5))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "cf7e387c-bb8f-434f-9ba4-beec33db8f1e",
   "metadata": {},
   "outputs": [],
   "source": [
    "#cluster, exposure\n",
    "cluster_0_0 = cluster_0[cluster_0[\"exposure\"]==0]\n",
    "cluster_1_0 = cluster_1[cluster_1[\"exposure\"]==0]\n",
    "cluster_2_0 = cluster_2[cluster_2[\"exposure\"]==0]\n",
    "cluster_3_0 = cluster_3[cluster_3[\"exposure\"]==0]\n",
    "cluster_4_0 = cluster_4[cluster_4[\"exposure\"]==0]\n",
    "cluster_5_0 = cluster_5[cluster_5[\"exposure\"]==0]\n",
    "\n",
    "cluster_0_30 = cluster_0[cluster_0[\"exposure\"]==30]\n",
    "cluster_1_30 = cluster_1[cluster_1[\"exposure\"]==30]\n",
    "cluster_2_30 = cluster_2[cluster_2[\"exposure\"]==30]\n",
    "cluster_3_30 = cluster_3[cluster_3[\"exposure\"]==30]\n",
    "cluster_4_30 = cluster_4[cluster_4[\"exposure\"]==30]\n",
    "cluster_5_30 = cluster_5[cluster_5[\"exposure\"]==30]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "id": "597da361-ddd4-4817-8bef-5b639721d081",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2736\n",
      "2044\n",
      "2180\n",
      "1308\n",
      "1864\n",
      "1262\n",
      "2132\n",
      "1799\n",
      "1711\n",
      "959\n",
      "1578\n",
      "1232\n"
     ]
    }
   ],
   "source": [
    "##cluster_exposure=0\n",
    "print(len(cluster_0_0))\n",
    "print(len(cluster_1_0))\n",
    "print(len(cluster_2_0))\n",
    "print(len(cluster_3_0))\n",
    "print(len(cluster_4_0))\n",
    "print(len(cluster_5_0))\n",
    "\n",
    "##cluster_exposure=30\n",
    "print(len(cluster_0_30))\n",
    "print(len(cluster_1_30))\n",
    "print(len(cluster_2_30))\n",
    "print(len(cluster_3_30))\n",
    "print(len(cluster_4_30))\n",
    "print(len(cluster_5_30))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "id": "a01585d5-9f00-4292-8c45-d86fd3e647bc",
   "metadata": {},
   "outputs": [],
   "source": [
    "#cluster_exposure=0_quantity\n",
    "cluster_0_0_0 = cluster_0_0[cluster_0_0[\"quantity\"]==\"0\"]\n",
    "cluster_0_0_10n = cluster_0_0[cluster_0_0[\"quantity\"]==\"10n\"]\n",
    "cluster_0_0_100n = cluster_0_0[cluster_0_0[\"quantity\"]==\"100n\"]\n",
    "cluster_0_0_1u = cluster_0_0[cluster_0_0[\"quantity\"]==\"1u\"]\n",
    "\n",
    "cluster_1_0_0 = cluster_1_0[cluster_1_0[\"quantity\"]==\"0\"]\n",
    "cluster_1_0_10n = cluster_1_0[cluster_1_0[\"quantity\"]==\"10n\"]\n",
    "cluster_1_0_100n = cluster_1_0[cluster_1_0[\"quantity\"]==\"100n\"]\n",
    "cluster_1_0_1u = cluster_1_0[cluster_1_0[\"quantity\"]==\"1u\"]\n",
    "\n",
    "cluster_2_0_0 = cluster_2_0[cluster_2_0[\"quantity\"]==\"0\"]\n",
    "cluster_2_0_10n = cluster_2_0[cluster_2_0[\"quantity\"]==\"10n\"]\n",
    "cluster_2_0_100n = cluster_2_0[cluster_2_0[\"quantity\"]==\"100n\"]\n",
    "cluster_2_0_1u = cluster_2_0[cluster_2_0[\"quantity\"]==\"1u\"]\n",
    "\n",
    "cluster_3_0_0 = cluster_3_0[cluster_3_0[\"quantity\"]==\"0\"]\n",
    "cluster_3_0_10n = cluster_3_0[cluster_3_0[\"quantity\"]==\"10n\"]\n",
    "cluster_3_0_100n = cluster_3_0[cluster_3_0[\"quantity\"]==\"100n\"]\n",
    "cluster_3_0_1u = cluster_3_0[cluster_3_0[\"quantity\"]==\"1u\"]\n",
    "\n",
    "cluster_4_0_0 = cluster_4_0[cluster_4_0[\"quantity\"]==\"0\"]\n",
    "cluster_4_0_10n = cluster_4_0[cluster_4_0[\"quantity\"]==\"10n\"]\n",
    "cluster_4_0_100n = cluster_4_0[cluster_4_0[\"quantity\"]==\"100n\"]\n",
    "cluster_4_0_1u = cluster_4_0[cluster_4_0[\"quantity\"]==\"1u\"]\n",
    "\n",
    "cluster_5_0_0 = cluster_5_0[cluster_5_0[\"quantity\"]==\"0\"]\n",
    "cluster_5_0_10n = cluster_5_0[cluster_5_0[\"quantity\"]==\"10n\"]\n",
    "cluster_5_0_100n = cluster_5_0[cluster_5_0[\"quantity\"]==\"100n\"]\n",
    "cluster_5_0_1u = cluster_5_0[cluster_5_0[\"quantity\"]==\"1u\"]\n",
    "\n",
    "#cluster_exposure=30_quantity\n",
    "cluster_0_30_0 = cluster_0_30[cluster_0_30[\"quantity\"]==\"0\"]\n",
    "cluster_0_30_10n = cluster_0_30[cluster_0_30[\"quantity\"]==\"10n\"]\n",
    "cluster_0_30_100n = cluster_0_30[cluster_0_30[\"quantity\"]==\"100n\"]\n",
    "cluster_0_30_1u = cluster_0_30[cluster_0_30[\"quantity\"]==\"1u\"]\n",
    "\n",
    "cluster_1_30_0 = cluster_1_30[cluster_1_30[\"quantity\"]==\"0\"]\n",
    "cluster_1_30_10n = cluster_1_30[cluster_1_30[\"quantity\"]==\"10n\"]\n",
    "cluster_1_30_100n = cluster_1_30[cluster_1_30[\"quantity\"]==\"100n\"]\n",
    "cluster_1_30_1u = cluster_1_30[cluster_1_30[\"quantity\"]==\"1u\"]\n",
    "\n",
    "cluster_2_30_0 = cluster_2_30[cluster_2_30[\"quantity\"]==\"0\"]\n",
    "cluster_2_30_10n = cluster_2_30[cluster_2_30[\"quantity\"]==\"10n\"]\n",
    "cluster_2_30_100n = cluster_2_30[cluster_2_30[\"quantity\"]==\"100n\"]\n",
    "cluster_2_30_1u = cluster_2_30[cluster_2_30[\"quantity\"]==\"1u\"]\n",
    "\n",
    "cluster_3_30_0 = cluster_3_30[cluster_3_30[\"quantity\"]==\"0\"]\n",
    "cluster_3_30_10n = cluster_3_30[cluster_3_30[\"quantity\"]==\"10n\"]\n",
    "cluster_3_30_100n = cluster_3_30[cluster_3_30[\"quantity\"]==\"100n\"]\n",
    "cluster_3_30_1u = cluster_3_30[cluster_3_30[\"quantity\"]==\"1u\"]\n",
    "\n",
    "cluster_4_30_0 = cluster_4_30[cluster_4_30[\"quantity\"]==\"0\"]\n",
    "cluster_4_30_10n = cluster_4_30[cluster_4_30[\"quantity\"]==\"10n\"]\n",
    "cluster_4_30_100n = cluster_4_30[cluster_4_30[\"quantity\"]==\"100n\"]\n",
    "cluster_4_30_1u = cluster_4_30[cluster_4_30[\"quantity\"]==\"1u\"]\n",
    "\n",
    "cluster_5_30_0 = cluster_5_30[cluster_5_30[\"quantity\"]==\"0\"]\n",
    "cluster_5_30_10n = cluster_5_30[cluster_5_30[\"quantity\"]==\"10n\"]\n",
    "cluster_5_30_100n = cluster_5_30[cluster_5_30[\"quantity\"]==\"100n\"]\n",
    "cluster_5_30_1u = cluster_5_30[cluster_5_30[\"quantity\"]==\"1u\"]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "id": "817817a5-8da6-4af9-a443-0e76a981e113",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "848\n",
      "627\n",
      "575\n",
      "686\n",
      "580\n",
      "529\n",
      "456\n",
      "479\n",
      "864\n",
      "449\n",
      "397\n",
      "470\n",
      "437\n",
      "275\n",
      "288\n",
      "308\n",
      "755\n",
      "349\n",
      "343\n",
      "417\n",
      "478\n",
      "235\n",
      "258\n",
      "291\n",
      "595\n",
      "398\n",
      "454\n",
      "685\n",
      "428\n",
      "367\n",
      "423\n",
      "581\n",
      "484\n",
      "437\n",
      "339\n",
      "451\n",
      "260\n",
      "228\n",
      "229\n",
      "242\n",
      "443\n",
      "314\n",
      "359\n",
      "462\n",
      "388\n",
      "260\n",
      "233\n",
      "351\n"
     ]
    }
   ],
   "source": [
    "#cluster_exposure=0_quantity\n",
    "print(len(cluster_0_0_0))\n",
    "print(len(cluster_0_0_10n))\n",
    "print(len(cluster_0_0_100n))\n",
    "print(len(cluster_0_0_1u))\n",
    "\n",
    "print(len(cluster_1_0_0))\n",
    "print(len(cluster_1_0_10n))\n",
    "print(len(cluster_1_0_100n))\n",
    "print(len(cluster_1_0_1u))\n",
    "\n",
    "print(len(cluster_2_0_0))\n",
    "print(len(cluster_2_0_10n))\n",
    "print(len(cluster_2_0_100n))\n",
    "print(len(cluster_2_0_1u))\n",
    "\n",
    "print(len(cluster_3_0_0))\n",
    "print(len(cluster_3_0_10n))\n",
    "print(len(cluster_3_0_100n))\n",
    "print(len(cluster_3_0_1u))\n",
    "\n",
    "print(len(cluster_4_0_0))\n",
    "print(len(cluster_4_0_10n))\n",
    "print(len(cluster_4_0_100n))\n",
    "print(len(cluster_4_0_1u))\n",
    "\n",
    "print(len(cluster_5_0_0))\n",
    "print(len(cluster_5_0_10n))\n",
    "print(len(cluster_5_0_100n))\n",
    "print(len(cluster_5_0_1u))\n",
    "\n",
    "#exposure=30\n",
    "print(len(cluster_0_30_0))\n",
    "print(len(cluster_0_30_10n))\n",
    "print(len(cluster_0_30_100n))\n",
    "print(len(cluster_0_30_1u))\n",
    "\n",
    "print(len(cluster_1_30_0))\n",
    "print(len(cluster_1_30_10n))\n",
    "print(len(cluster_1_30_100n))\n",
    "print(len(cluster_1_30_1u))\n",
    "\n",
    "print(len(cluster_2_30_0))\n",
    "print(len(cluster_2_30_10n))\n",
    "print(len(cluster_2_30_100n))\n",
    "print(len(cluster_2_30_1u))\n",
    "\n",
    "print(len(cluster_3_30_0))\n",
    "print(len(cluster_3_30_10n))\n",
    "print(len(cluster_3_30_100n))\n",
    "print(len(cluster_3_30_1u))\n",
    "\n",
    "print(len(cluster_4_30_0))\n",
    "print(len(cluster_4_30_10n))\n",
    "print(len(cluster_4_30_100n))\n",
    "print(len(cluster_4_30_1u))\n",
    "\n",
    "print(len(cluster_5_30_0))\n",
    "print(len(cluster_5_30_10n))\n",
    "print(len(cluster_5_30_100n))\n",
    "print(len(cluster_5_30_1u))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "id": "c35f0b38",
   "metadata": {},
   "outputs": [],
   "source": [
    "# TODO: \"continue-for\" if the last element is reached\n",
    "def subplot_gen(cluster_df, n_row, n_col, n_fig, path, train_np):\n",
    "    \n",
    "    i_c = cluster_df.index.values.astype(int)\n",
    "    count_c = 0\n",
    "    l_c = len(cluster_df)\n",
    "    \n",
    "    for i in range(n_fig):\n",
    "        fig, axs = plt.subplots(n_col, n_row, figsize=(25,25), constrained_layout=True,\n",
    "                        sharex=True, sharey=True)#,sharex='col', sharey='row')\n",
    "        plt.figure(figsize=(5,5), dpi= 100, facecolor='w', edgecolor='k')\n",
    "        plt.rcParams['figure.figsize'] = [16, 24]\n",
    "        plt.rcParams['figure.dpi'] = 100 # 200 e.g. is really fine, but slower\n",
    "        plt.tight_layout(pad=0.01, w_pad=0, h_pad=0)\n",
    "\n",
    "        for k in range(n_row):\n",
    "            for j in range(n_col):\n",
    "                if count_c < l_c:\n",
    "                    axs[j, k].imshow(train_np[i_c[count_c]].reshape(144,144),cmap='gray', interpolation='nearest')\n",
    "                    axs[j, k].axis('off')\n",
    "                    count_c += 1\n",
    "\n",
    "        plt.close() #try to remove this\n",
    "        path_filename = path+str(i)+\".png\"\n",
    "        plt.savefig(path_filename)\n",
    "        plt.close(\"all\")\n",
    "    \n",
    "    return"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "id": "1e5eb864",
   "metadata": {},
   "outputs": [],
   "source": [
    "img_list = []\n",
    "\n",
    "for elem in list_images:\n",
    "    elem = elem * 255\n",
    "    img_list.append(elem)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "id": "ccdab3e9",
   "metadata": {},
   "outputs": [],
   "source": [
    "from matplotlib import pyplot as plt\n",
    "\n",
    "n_fig = 10\n",
    "n_row = 3\n",
    "n_col = 3\n",
    "#exposure=0\n",
    "path_0_0_0 = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/0/0/0/\"\n",
    "path_0_0_10n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/0/0/10n/\"\n",
    "path_0_0_100n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/0/0/100n/\"\n",
    "path_0_0_1u = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/0/0/1000n/\"\n",
    "\n",
    "path_1_0_0 = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/1/0/0/\"\n",
    "path_1_0_10n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/1/0/10n/\"\n",
    "path_1_0_100n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/1/0/100n/\"\n",
    "path_1_0_1u = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/1/0/1000n/\"\n",
    "\n",
    "path_2_0_0 = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/2/0/0/\"\n",
    "path_2_0_10n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/2/0/10n/\"\n",
    "path_2_0_100n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/2/0/100n/\"\n",
    "path_2_0_1u = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/2/0/1000n/\"\n",
    "\n",
    "path_3_0_0 = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/3/0/0/\"\n",
    "path_3_0_10n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/3/0/10n/\"\n",
    "path_3_0_100n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/3/0/100n/\"\n",
    "path_3_0_1u = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/3/0/1000n/\"\n",
    "\n",
    "path_4_0_0 = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/4/0/0/\"\n",
    "path_4_0_10n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/4/0/10n/\"\n",
    "path_4_0_100n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/4/0/100n/\"\n",
    "path_4_0_1u = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/4/0/1000n/\"\n",
    "\n",
    "path_5_0_0 = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/5/0/0/\"\n",
    "path_5_0_10n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/5/0/10n/\"\n",
    "path_5_0_100n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/5/0/100n/\"\n",
    "path_5_0_1u = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/5/0/1000n/\"\n",
    "\n",
    "#exposure=30\n",
    "path_0_30_0 = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/0/30/0/\"\n",
    "path_0_30_10n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/0/30/10n/\"\n",
    "path_0_30_100n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/0/30/100n/\"\n",
    "path_0_30_1u = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/0/30/1000n/\"\n",
    "\n",
    "path_1_30_0 = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/1/30/0/\"\n",
    "path_1_30_10n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/1/30/10n/\"\n",
    "path_1_30_100n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/1/30/100n/\"\n",
    "path_1_30_1u = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/1/30/1000n/\"\n",
    "\n",
    "path_2_30_0 = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/2/30/0/\"\n",
    "path_2_30_10n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/2/30/10n/\"\n",
    "path_2_30_100n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/2/30/100n/\"\n",
    "path_2_30_1u = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/2/30/1000n/\"\n",
    "\n",
    "path_3_30_0 = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/3/30/0/\"\n",
    "path_3_30_10n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/3/30/10n/\"\n",
    "path_3_30_100n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/3/30/100n/\"\n",
    "path_3_30_1u = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/3/30/1000n/\"\n",
    "\n",
    "path_4_30_0 = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/4/30/0/\"\n",
    "path_4_30_10n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/4/30/10n/\"\n",
    "path_4_30_100n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/4/30/100n/\"\n",
    "path_4_30_1u = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/4/30/1000n/\"\n",
    "\n",
    "path_5_30_0 = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/5/30/0/\"\n",
    "path_5_30_10n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/5/30/10n/\"\n",
    "path_5_30_100n = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/5/30/100n/\"\n",
    "path_5_30_1u = \"/Users/andresammx/Documents/Python/img_09052022/ah_6/5/30/1000n/\"\n",
    "\n",
    "#0\n",
    "subplot_gen(cluster_0_0_0, n_row, n_col, n_fig, path_0_0_0, img_list)\n",
    "subplot_gen(cluster_0_0_10n, n_row, n_col, n_fig, path_0_0_10n, img_list)\n",
    "subplot_gen(cluster_0_0_100n, n_row, n_col, n_fig, path_0_0_100n, img_list)\n",
    "subplot_gen(cluster_0_0_1u, n_row, n_col, n_fig, path_0_0_1u, img_list)\n",
    "\n",
    "subplot_gen(cluster_1_0_0, n_row, n_col, n_fig, path_1_0_0, img_list)\n",
    "subplot_gen(cluster_1_0_10n, n_row, n_col, n_fig, path_1_0_10n, img_list)\n",
    "subplot_gen(cluster_1_0_100n, n_row, n_col, n_fig, path_1_0_100n, img_list)\n",
    "subplot_gen(cluster_1_0_1u, n_row, n_col, n_fig, path_1_0_1u, img_list)\n",
    "\n",
    "subplot_gen(cluster_2_0_0, n_row, n_col, n_fig, path_2_0_0, img_list)\n",
    "subplot_gen(cluster_2_0_10n, n_row, n_col, n_fig, path_2_0_10n, img_list)\n",
    "subplot_gen(cluster_2_0_100n, n_row, n_col, n_fig, path_2_0_100n, img_list)\n",
    "subplot_gen(cluster_2_0_1u, n_row, n_col, n_fig, path_2_0_1u, img_list)\n",
    "\n",
    "subplot_gen(cluster_3_0_0, n_row, n_col, n_fig, path_3_0_0, img_list)\n",
    "subplot_gen(cluster_3_0_10n, n_row, n_col, n_fig, path_3_0_10n, img_list)\n",
    "subplot_gen(cluster_3_0_100n, n_row, n_col, n_fig, path_3_0_100n, img_list)\n",
    "subplot_gen(cluster_3_0_1u, n_row, n_col, n_fig, path_3_0_1u, img_list)\n",
    "\n",
    "subplot_gen(cluster_4_0_0, n_row, n_col, n_fig, path_4_0_0, img_list)\n",
    "subplot_gen(cluster_4_0_10n, n_row, n_col, n_fig, path_4_0_10n, img_list)\n",
    "subplot_gen(cluster_4_0_100n, n_row, n_col, n_fig, path_4_0_100n, img_list)\n",
    "subplot_gen(cluster_4_0_1u, n_row, n_col, n_fig, path_4_0_1u, img_list)\n",
    "\n",
    "subplot_gen(cluster_5_0_0, n_row, n_col, n_fig, path_5_0_0, img_list)\n",
    "subplot_gen(cluster_5_0_10n, n_row, n_col, n_fig, path_5_0_10n, img_list)\n",
    "subplot_gen(cluster_5_0_100n, n_row, n_col, n_fig, path_5_0_100n, img_list)\n",
    "subplot_gen(cluster_5_0_1u, n_row, n_col, n_fig, path_5_0_1u, img_list)\n",
    "\n",
    "\n",
    "#30\n",
    "subplot_gen(cluster_0_30_0, n_row, n_col, n_fig, path_0_30_0, img_list)\n",
    "subplot_gen(cluster_0_30_10n, n_row, n_col, n_fig, path_0_30_10n, img_list)\n",
    "subplot_gen(cluster_0_30_100n, n_row, n_col, n_fig, path_0_30_100n, img_list)\n",
    "subplot_gen(cluster_0_30_1u, n_row, n_col, n_fig, path_0_30_1u, img_list)\n",
    "\n",
    "subplot_gen(cluster_1_30_0, n_row, n_col, n_fig, path_1_30_0, img_list)\n",
    "subplot_gen(cluster_1_30_10n, n_row, n_col, n_fig, path_1_30_10n, img_list)\n",
    "subplot_gen(cluster_1_30_100n, n_row, n_col, n_fig, path_1_30_100n, img_list)\n",
    "subplot_gen(cluster_1_30_1u, n_row, n_col, n_fig, path_1_30_1u, img_list)\n",
    "\n",
    "subplot_gen(cluster_2_30_0, n_row, n_col, n_fig, path_2_30_0, img_list)\n",
    "subplot_gen(cluster_2_30_10n, n_row, n_col, n_fig, path_2_30_10n, img_list)\n",
    "subplot_gen(cluster_2_30_100n, n_row, n_col, n_fig, path_2_30_100n, img_list)\n",
    "subplot_gen(cluster_2_30_1u, n_row, n_col, n_fig, path_2_30_1u, img_list)\n",
    "\n",
    "subplot_gen(cluster_3_30_0, n_row, n_col, n_fig, path_3_30_0, img_list)\n",
    "subplot_gen(cluster_3_30_10n, n_row, n_col, n_fig, path_3_30_10n, img_list)\n",
    "subplot_gen(cluster_3_30_100n, n_row, n_col, n_fig, path_3_30_100n, img_list)\n",
    "subplot_gen(cluster_3_30_1u, n_row, n_col, n_fig, path_3_30_1u, img_list)\n",
    "\n",
    "subplot_gen(cluster_4_30_0, n_row, n_col, n_fig, path_4_30_0, img_list)\n",
    "subplot_gen(cluster_4_30_10n, n_row, n_col, n_fig, path_4_30_10n, img_list)\n",
    "subplot_gen(cluster_4_30_100n, n_row, n_col, n_fig, path_4_30_100n, img_list)\n",
    "subplot_gen(cluster_4_30_1u, n_row, n_col, n_fig, path_4_30_1u, img_list)\n",
    "\n",
    "subplot_gen(cluster_5_30_0, n_row, n_col, n_fig, path_5_30_0, img_list)\n",
    "subplot_gen(cluster_5_30_10n, n_row, n_col, n_fig, path_5_30_10n, img_list)\n",
    "subplot_gen(cluster_5_30_100n, n_row, n_col, n_fig, path_5_30_100n, img_list)\n",
    "subplot_gen(cluster_5_30_1u, n_row, n_col, n_fig, path_5_30_1u, img_list)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "65bda556",
   "metadata": {},
   "source": [
    "## Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "895997dc",
   "metadata": {},
   "outputs": [],
   "source": [
    "stat_df = master_df.copy()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "aa4223db",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>date</th>\n",
       "      <th>quantity</th>\n",
       "      <th>exposure</th>\n",
       "      <th>tracked_id</th>\n",
       "      <th>traj</th>\n",
       "      <th>VCL</th>\n",
       "      <th>VAP</th>\n",
       "      <th>VSL</th>\n",
       "      <th>LIN</th>\n",
       "      <th>STR</th>\n",
       "      <th>WOB</th>\n",
       "      <th>BeatCross</th>\n",
       "      <th>ALH</th>\n",
       "      <th>img</th>\n",
       "      <th>cluster</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>[[69, 70, 71, 71, 72, 73, 73, 74, 75, 76, 76, ...</td>\n",
       "      <td>79.959810</td>\n",
       "      <td>65.180660</td>\n",
       "      <td>60.576260</td>\n",
       "      <td>0.757584</td>\n",
       "      <td>0.929359</td>\n",
       "      <td>0.815168</td>\n",
       "      <td>30.000000</td>\n",
       "      <td>4.276645</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>[[209, 208, 210, 210, 211, 212, 212, 214, 214,...</td>\n",
       "      <td>89.038410</td>\n",
       "      <td>47.606697</td>\n",
       "      <td>44.321228</td>\n",
       "      <td>0.497777</td>\n",
       "      <td>0.930987</td>\n",
       "      <td>0.534676</td>\n",
       "      <td>44.482758</td>\n",
       "      <td>3.3122602</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>[[166, 166, 166, 166, 166, 166, 165, 165, 164,...</td>\n",
       "      <td>55.782050</td>\n",
       "      <td>39.061245</td>\n",
       "      <td>37.602840</td>\n",
       "      <td>0.674103</td>\n",
       "      <td>0.962664</td>\n",
       "      <td>0.700248</td>\n",
       "      <td>33.846153</td>\n",
       "      <td>2.2061138</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>[[153, 152, 151, 151, 150, 149, 149, 149, 148,...</td>\n",
       "      <td>61.317635</td>\n",
       "      <td>50.661057</td>\n",
       "      <td>48.099777</td>\n",
       "      <td>0.784436</td>\n",
       "      <td>0.949443</td>\n",
       "      <td>0.826207</td>\n",
       "      <td>36.585365</td>\n",
       "      <td>3.6620018</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>balder</td>\n",
       "      <td>01062021-25</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>[[101, 100, 100, 100, 100, 92, 91, 91, 92, 91,...</td>\n",
       "      <td>92.437790</td>\n",
       "      <td>31.140326</td>\n",
       "      <td>24.251595</td>\n",
       "      <td>0.262356</td>\n",
       "      <td>0.778784</td>\n",
       "      <td>0.336879</td>\n",
       "      <td>21.600000</td>\n",
       "      <td>2.8383772</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20800</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>[[1, 2, 3, 4, 4, 6, 7, 8, 8, 10, 11, 12, 12, 1...</td>\n",
       "      <td>96.704130</td>\n",
       "      <td>64.950470</td>\n",
       "      <td>59.788445</td>\n",
       "      <td>0.618262</td>\n",
       "      <td>0.920524</td>\n",
       "      <td>0.671641</td>\n",
       "      <td>26.470589</td>\n",
       "      <td>3.6918447</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20801</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>290.0</td>\n",
       "      <td>[[407, 406, 407, 404, 403, 402, 401, 401, 401,...</td>\n",
       "      <td>120.385190</td>\n",
       "      <td>59.779380</td>\n",
       "      <td>54.945923</td>\n",
       "      <td>0.456418</td>\n",
       "      <td>0.919145</td>\n",
       "      <td>0.496568</td>\n",
       "      <td>28.000000</td>\n",
       "      <td>3.6505616</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20802</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>291.0</td>\n",
       "      <td>[[200, 201, 200, 202, 202, 202, 203, 203, 203,...</td>\n",
       "      <td>58.640600</td>\n",
       "      <td>30.063608</td>\n",
       "      <td>27.091166</td>\n",
       "      <td>0.461986</td>\n",
       "      <td>0.901128</td>\n",
       "      <td>0.512676</td>\n",
       "      <td>23.571428</td>\n",
       "      <td>2.008077</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20803</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>293.0</td>\n",
       "      <td>[[182, 181, 181, 180, 181, 181, 180, 181, 180,...</td>\n",
       "      <td>68.929520</td>\n",
       "      <td>18.630800</td>\n",
       "      <td>17.365812</td>\n",
       "      <td>0.251936</td>\n",
       "      <td>0.932102</td>\n",
       "      <td>0.270288</td>\n",
       "      <td>32.142857</td>\n",
       "      <td>2.827821</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20804</th>\n",
       "      <td>loki</td>\n",
       "      <td>10032020-9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>295.0</td>\n",
       "      <td>[[270, 271, 271, 271, 272, 272, 272, 272, 273,...</td>\n",
       "      <td>57.033836</td>\n",
       "      <td>35.512478</td>\n",
       "      <td>33.005080</td>\n",
       "      <td>0.578693</td>\n",
       "      <td>0.929394</td>\n",
       "      <td>0.622656</td>\n",
       "      <td>23.076923</td>\n",
       "      <td>2.561492</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20805 rows × 16 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         name         date quantity  exposure  tracked_id  \\\n",
       "0      balder  01062021-25        0       0.0         1.0   \n",
       "1      balder  01062021-25        0       0.0         3.0   \n",
       "2      balder  01062021-25        0       0.0         4.0   \n",
       "3      balder  01062021-25        0       0.0         6.0   \n",
       "4      balder  01062021-25        0       0.0         7.0   \n",
       "...       ...          ...      ...       ...         ...   \n",
       "20800    loki   10032020-9        0       0.0       287.0   \n",
       "20801    loki   10032020-9        0       0.0       290.0   \n",
       "20802    loki   10032020-9        0       0.0       291.0   \n",
       "20803    loki   10032020-9        0       0.0       293.0   \n",
       "20804    loki   10032020-9        0       0.0       295.0   \n",
       "\n",
       "                                                    traj         VCL  \\\n",
       "0      [[69, 70, 71, 71, 72, 73, 73, 74, 75, 76, 76, ...   79.959810   \n",
       "1      [[209, 208, 210, 210, 211, 212, 212, 214, 214,...   89.038410   \n",
       "2      [[166, 166, 166, 166, 166, 166, 165, 165, 164,...   55.782050   \n",
       "3      [[153, 152, 151, 151, 150, 149, 149, 149, 148,...   61.317635   \n",
       "4      [[101, 100, 100, 100, 100, 92, 91, 91, 92, 91,...   92.437790   \n",
       "...                                                  ...         ...   \n",
       "20800  [[1, 2, 3, 4, 4, 6, 7, 8, 8, 10, 11, 12, 12, 1...   96.704130   \n",
       "20801  [[407, 406, 407, 404, 403, 402, 401, 401, 401,...  120.385190   \n",
       "20802  [[200, 201, 200, 202, 202, 202, 203, 203, 203,...   58.640600   \n",
       "20803  [[182, 181, 181, 180, 181, 181, 180, 181, 180,...   68.929520   \n",
       "20804  [[270, 271, 271, 271, 272, 272, 272, 272, 273,...   57.033836   \n",
       "\n",
       "             VAP        VSL       LIN       STR       WOB  BeatCross  \\\n",
       "0      65.180660  60.576260  0.757584  0.929359  0.815168  30.000000   \n",
       "1      47.606697  44.321228  0.497777  0.930987  0.534676  44.482758   \n",
       "2      39.061245  37.602840  0.674103  0.962664  0.700248  33.846153   \n",
       "3      50.661057  48.099777  0.784436  0.949443  0.826207  36.585365   \n",
       "4      31.140326  24.251595  0.262356  0.778784  0.336879  21.600000   \n",
       "...          ...        ...       ...       ...       ...        ...   \n",
       "20800  64.950470  59.788445  0.618262  0.920524  0.671641  26.470589   \n",
       "20801  59.779380  54.945923  0.456418  0.919145  0.496568  28.000000   \n",
       "20802  30.063608  27.091166  0.461986  0.901128  0.512676  23.571428   \n",
       "20803  18.630800  17.365812  0.251936  0.932102  0.270288  32.142857   \n",
       "20804  35.512478  33.005080  0.578693  0.929394  0.622656  23.076923   \n",
       "\n",
       "             ALH                                                img  cluster  \n",
       "0       4.276645  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        0  \n",
       "1      3.3122602  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        0  \n",
       "2      2.2061138  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        4  \n",
       "3      3.6620018  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        0  \n",
       "4      2.8383772  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        2  \n",
       "...          ...                                                ...      ...  \n",
       "20800  3.6918447  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        0  \n",
       "20801  3.6505616  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        4  \n",
       "20802   2.008077  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        2  \n",
       "20803   2.827821  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        2  \n",
       "20804   2.561492  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        4  \n",
       "\n",
       "[20805 rows x 16 columns]"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stat_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "id": "6f7f918c",
   "metadata": {},
   "outputs": [],
   "source": [
    "ALH_list = []\n",
    "\n",
    "for elem in stat_df[\"ALH\"]:\n",
    "    float_alh = float(elem)\n",
    "    ALH_list.append(float_alh)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "id": "421bac64",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[4.276645,\n",
       " 3.3122602,\n",
       " 2.2061138,\n",
       " 3.6620018,\n",
       " 2.8383772,\n",
       " 3.9848301,\n",
       " 3.1730235,\n",
       " 2.4302254,\n",
       " 3.5944023,\n",
       " 4.226328,\n",
       " 4.703278,\n",
       " 5.0055914,\n",
       " 3.1341271,\n",
       " 3.651837,\n",
       " 3.1021948,\n",
       " 3.6722848,\n",
       " 4.932422,\n",
       " 2.9991112,\n",
       " 3.5718513,\n",
       " 2.886544,\n",
       " 6.0313625,\n",
       " 4.80546,\n",
       " 3.0197403,\n",
       " 4.685035,\n",
       " 3.2093356,\n",
       " 4.413181,\n",
       " 3.104858,\n",
       " 2.9704125,\n",
       " 2.2824821,\n",
       " 3.411763,\n",
       " 3.8517041,\n",
       " 1.7147628,\n",
       " 4.8389907,\n",
       " 5.5049486,\n",
       " 2.6130693,\n",
       " 2.7559507,\n",
       " 2.8936386,\n",
       " 3.8704588,\n",
       " 2.618237,\n",
       " 2.1071162,\n",
       " 3.7406242,\n",
       " 4.2662168,\n",
       " 1.9031069,\n",
       " 4.416835,\n",
       " 2.662553,\n",
       " 2.2015212,\n",
       " 2.4877818,\n",
       " 4.42268,\n",
       " 5.5798097,\n",
       " 4.971103,\n",
       " 5.4170637,\n",
       " 3.4568002,\n",
       " 3.9403086,\n",
       " 5.5055804,\n",
       " 3.0419383,\n",
       " 3.2552977,\n",
       " 2.7045782,\n",
       " 2.5988386,\n",
       " 4.3036003,\n",
       " 2.6212993,\n",
       " 2.5422015,\n",
       " 3.188233,\n",
       " 3.502512,\n",
       " 5.0760355,\n",
       " 3.1924531,\n",
       " 2.8783987,\n",
       " 4.018447,\n",
       " 4.515606,\n",
       " 2.4074943,\n",
       " 3.6269126,\n",
       " 3.638655,\n",
       " 3.030022,\n",
       " 4.1144314,\n",
       " 3.8311305,\n",
       " 7.5692143,\n",
       " 6.4853525,\n",
       " 4.8560305,\n",
       " 2.5831654,\n",
       " 6.469843,\n",
       " 5.3199677,\n",
       " 3.7037091,\n",
       " 6.3561835,\n",
       " 3.3531373,\n",
       " 4.5306864,\n",
       " 3.8558986,\n",
       " 3.2601964,\n",
       " 2.427455,\n",
       " 5.484786,\n",
       " 3.1010783,\n",
       " 3.23361,\n",
       " 5.6463404,\n",
       " 5.046786,\n",
       " 3.4372404,\n",
       " 4.6158643,\n",
       " 5.325318,\n",
       " 4.557357,\n",
       " 3.703668,\n",
       " 4.6761236,\n",
       " 3.1430218,\n",
       " 3.268237,\n",
       " 6.929916,\n",
       " 3.9186082,\n",
       " 3.5962832,\n",
       " 4.4735756,\n",
       " 3.9364183,\n",
       " 4.9555264,\n",
       " 3.447453,\n",
       " 2.8141518,\n",
       " 4.366556,\n",
       " 2.913486,\n",
       " 7.646197,\n",
       " 4.503792,\n",
       " 4.9028416,\n",
       " 2.969323,\n",
       " 4.617346,\n",
       " 3.972347,\n",
       " 4.0764503,\n",
       " 2.0373473,\n",
       " 2.9427688,\n",
       " 2.750134,\n",
       " 3.2528872,\n",
       " 1.8837422,\n",
       " 3.7533016,\n",
       " 5.4484677,\n",
       " 3.66449,\n",
       " 6.35122,\n",
       " 3.5097241,\n",
       " 2.606397,\n",
       " 3.6483033,\n",
       " 3.360377,\n",
       " 5.7449856,\n",
       " 2.055964,\n",
       " 2.95008,\n",
       " 2.8203757,\n",
       " 4.650551,\n",
       " 4.0021386,\n",
       " 6.599579,\n",
       " 5.806822,\n",
       " 3.7592943,\n",
       " 3.1315997,\n",
       " 8.394408,\n",
       " 5.283718,\n",
       " 8.397565,\n",
       " 1.5450625,\n",
       " 3.355593,\n",
       " 4.697954,\n",
       " 3.1734746,\n",
       " 3.9584975,\n",
       " 2.9848912,\n",
       " 4.4601054,\n",
       " 2.371636,\n",
       " 4.950857,\n",
       " 5.1469893,\n",
       " 3.5268092,\n",
       " 6.8808184,\n",
       " 2.6377003,\n",
       " 5.74277,\n",
       " 4.722602,\n",
       " 4.543347,\n",
       " 4.2253275,\n",
       " 2.3614602,\n",
       " 4.031664,\n",
       " 1.9540311,\n",
       " 3.2187293,\n",
       " 3.211358,\n",
       " 4.738848,\n",
       " 4.53113,\n",
       " 3.128888,\n",
       " 5.548867,\n",
       " 2.4632561,\n",
       " 4.025251,\n",
       " 3.9606755,\n",
       " 4.40635,\n",
       " 4.135599,\n",
       " 2.6737359,\n",
       " 3.9811115,\n",
       " 3.3943138,\n",
       " 1.9023303,\n",
       " 4.611512,\n",
       " 3.5935974,\n",
       " 4.564052,\n",
       " 3.7193964,\n",
       " 3.6657887,\n",
       " 4.137794,\n",
       " 4.1215186,\n",
       " 5.093572,\n",
       " 3.090768,\n",
       " 3.9800088,\n",
       " 2.544422,\n",
       " 3.026756,\n",
       " 3.8638933,\n",
       " 4.4659405,\n",
       " 2.271906,\n",
       " 3.3307266,\n",
       " 2.8973002,\n",
       " 3.5612164,\n",
       " 1.4431765,\n",
       " 3.856127,\n",
       " 5.5075994,\n",
       " 2.9174438,\n",
       " 2.2664225,\n",
       " 5.5213523,\n",
       " 4.9997296,\n",
       " 4.3870726,\n",
       " 3.2368984,\n",
       " 3.255331,\n",
       " 4.2690744,\n",
       " 3.3466141,\n",
       " 6.0968947,\n",
       " 3.8727884,\n",
       " 3.1141927,\n",
       " 1.4662457,\n",
       " 4.603428,\n",
       " 4.1527696,\n",
       " 3.0713959,\n",
       " 5.3093915,\n",
       " 4.3078847,\n",
       " 5.8593354,\n",
       " 1.7797128,\n",
       " 3.9340768,\n",
       " 3.1765358,\n",
       " 2.6532862,\n",
       " 3.0539052,\n",
       " 2.9065285,\n",
       " 3.879008,\n",
       " 3.677442,\n",
       " 3.9282112,\n",
       " 5.2033277,\n",
       " 3.0852127,\n",
       " 3.337809,\n",
       " 3.344131,\n",
       " 4.969574,\n",
       " 3.5019886,\n",
       " 5.4421954,\n",
       " 2.8080294,\n",
       " 3.1169434,\n",
       " 5.3208733,\n",
       " 3.338927,\n",
       " 2.4738739,\n",
       " 1.6698362,\n",
       " 4.204317,\n",
       " 3.8129246,\n",
       " 3.4046135,\n",
       " 3.1419768,\n",
       " 4.832288,\n",
       " 3.6503441,\n",
       " 3.0490804,\n",
       " 4.798233,\n",
       " 4.4504247,\n",
       " 3.0267072,\n",
       " 5.5184827,\n",
       " 2.4276443,\n",
       " 3.1715572,\n",
       " 3.7522526,\n",
       " 2.786975,\n",
       " 4.143915,\n",
       " 2.6253061,\n",
       " 3.52904,\n",
       " 3.576247,\n",
       " 3.0535464,\n",
       " 4.0289407,\n",
       " 3.6419568,\n",
       " 2.4846587,\n",
       " 3.5591364,\n",
       " 3.1118991,\n",
       " 4.7644057,\n",
       " 3.680001,\n",
       " 4.9147816,\n",
       " 2.344088,\n",
       " 4.3531356,\n",
       " 4.2728252,\n",
       " 2.838812,\n",
       " 3.3997023,\n",
       " 4.3273582,\n",
       " 3.1522262,\n",
       " 3.5192997,\n",
       " 3.2456102,\n",
       " 1.9354724,\n",
       " 3.1510658,\n",
       " 2.948114,\n",
       " 4.596441,\n",
       " 2.681892,\n",
       " 2.7866468,\n",
       " 4.7156034,\n",
       " 3.1254795,\n",
       " 4.348938,\n",
       " 2.5153081,\n",
       " 4.64828,\n",
       " 5.7547483,\n",
       " 3.0638442,\n",
       " 3.3546515,\n",
       " 5.5834503,\n",
       " 2.6068785,\n",
       " 4.38121,\n",
       " 5.2492614,\n",
       " 3.051019,\n",
       " 4.62114,\n",
       " 3.6797712,\n",
       " 2.4097414,\n",
       " 6.8363943,\n",
       " 2.7527046,\n",
       " 2.1894312,\n",
       " 2.4388843,\n",
       " 2.7715957,\n",
       " 3.249644,\n",
       " 3.5504427,\n",
       " 3.0816944,\n",
       " 1.4168516,\n",
       " 4.9265265,\n",
       " 4.12375,\n",
       " 6.290189,\n",
       " 3.5387976,\n",
       " 3.2627988,\n",
       " 3.5104456,\n",
       " 2.4486187,\n",
       " 5.632099,\n",
       " 4.6846385,\n",
       " 4.763194,\n",
       " 4.092329,\n",
       " 2.619349,\n",
       " 3.3291726,\n",
       " 5.316291,\n",
       " 3.9939475,\n",
       " 3.3437462,\n",
       " 3.2150707,\n",
       " 6.3784328,\n",
       " 2.9028635,\n",
       " 3.861503,\n",
       " 3.1872725,\n",
       " 4.3727493,\n",
       " 3.1868742,\n",
       " 1.6983637,\n",
       " 4.4844484,\n",
       " 7.463306,\n",
       " 5.3776593,\n",
       " 4.50824,\n",
       " 2.7541418,\n",
       " 5.831455,\n",
       " 2.4845512,\n",
       " 2.336322,\n",
       " 2.522468,\n",
       " 4.013231,\n",
       " 4.970769,\n",
       " 4.4271092,\n",
       " 3.958202,\n",
       " 2.628277,\n",
       " 4.7048817,\n",
       " 5.3022466,\n",
       " 4.6943684,\n",
       " 3.8856614,\n",
       " 4.7713585,\n",
       " 5.6713233,\n",
       " 3.3836906,\n",
       " 4.1807866,\n",
       " 1.8746482,\n",
       " 3.8346312,\n",
       " 5.480103,\n",
       " 4.7238326,\n",
       " 3.8211815,\n",
       " 4.927653,\n",
       " 4.420514,\n",
       " 2.2400596,\n",
       " 3.5242877,\n",
       " 3.1682935,\n",
       " 5.645791,\n",
       " 2.6460443,\n",
       " 4.129353,\n",
       " 5.763976,\n",
       " 1.6083286,\n",
       " 2.6553292,\n",
       " 1.5101883,\n",
       " 3.7935872,\n",
       " 3.6576362,\n",
       " 5.0999517,\n",
       " 5.5518875,\n",
       " 4.3418765,\n",
       " 4.331788,\n",
       " 3.492532,\n",
       " 3.5451834,\n",
       " 5.4389243,\n",
       " 5.1994557,\n",
       " 5.459022,\n",
       " 3.041134,\n",
       " 3.3762677,\n",
       " 4.046138,\n",
       " 3.3375142,\n",
       " 6.198327,\n",
       " 2.2572114,\n",
       " 5.759759,\n",
       " 3.3643787,\n",
       " 2.061264,\n",
       " 3.1877244,\n",
       " 2.9618464,\n",
       " 3.8443222,\n",
       " 4.6632895,\n",
       " 3.6529307,\n",
       " 3.2573535,\n",
       " 1.923665,\n",
       " 5.444788,\n",
       " 3.0064406,\n",
       " 2.8736937,\n",
       " 3.8716438,\n",
       " 4.071716,\n",
       " 5.0518885,\n",
       " 2.7800355,\n",
       " 1.6913149,\n",
       " 1.7524759,\n",
       " 5.9355726,\n",
       " 2.6415262,\n",
       " 2.0642955,\n",
       " 3.6709151,\n",
       " 4.2229385,\n",
       " 2.084746,\n",
       " 3.225864,\n",
       " 3.074699,\n",
       " 4.2272944,\n",
       " 4.0746346,\n",
       " 3.9488764,\n",
       " 1.822667,\n",
       " 2.1416428,\n",
       " 6.4295526,\n",
       " 2.1011415,\n",
       " 1.7769175,\n",
       " 4.6864276,\n",
       " 3.728512,\n",
       " 4.7350426,\n",
       " 7.8897176,\n",
       " 3.4006836,\n",
       " 3.5902267,\n",
       " 4.7850857,\n",
       " 4.3794203,\n",
       " 3.7148423,\n",
       " 2.6374495,\n",
       " 2.211058,\n",
       " 4.228884,\n",
       " 4.187864,\n",
       " 2.2858543,\n",
       " 2.128654,\n",
       " 2.578569,\n",
       " 2.3941202,\n",
       " 3.1507816,\n",
       " 2.3479772,\n",
       " 1.9075856,\n",
       " 6.398944,\n",
       " 2.8171792,\n",
       " 2.4230826,\n",
       " 3.5385916,\n",
       " 3.8192852,\n",
       " 3.1508703,\n",
       " 2.263751,\n",
       " 3.5533466,\n",
       " 2.4520748,\n",
       " 5.6347365,\n",
       " 2.785577,\n",
       " 2.4877408,\n",
       " 4.203294,\n",
       " 2.9137845,\n",
       " 6.2155795,\n",
       " 3.7273169,\n",
       " 1.8567469,\n",
       " 3.2996922,\n",
       " 3.4962482,\n",
       " 4.9697256,\n",
       " 2.2411335,\n",
       " 4.265756,\n",
       " 4.3947124,\n",
       " 3.6569932,\n",
       " 2.9296703,\n",
       " 4.1758995,\n",
       " 3.8234742,\n",
       " 3.0980911,\n",
       " 4.6258845,\n",
       " 4.0613346,\n",
       " 3.5630414,\n",
       " 3.422715,\n",
       " 2.4233289,\n",
       " 5.424472,\n",
       " 5.5752716,\n",
       " 2.2940648,\n",
       " 5.424841,\n",
       " 2.1947174,\n",
       " 2.7850404,\n",
       " 3.6263752,\n",
       " 3.7681763,\n",
       " 3.7735887,\n",
       " 7.118909,\n",
       " 4.5070577,\n",
       " 1.4292928,\n",
       " 3.0247939,\n",
       " 2.443423,\n",
       " 2.4226606,\n",
       " 6.4209776,\n",
       " 2.3615708,\n",
       " 4.158573,\n",
       " 3.0587223,\n",
       " 3.3779416,\n",
       " 4.460159,\n",
       " 4.0790286,\n",
       " 4.2056065,\n",
       " 5.207881,\n",
       " 2.7084043,\n",
       " 3.0765796,\n",
       " 2.9917428,\n",
       " 3.9666183,\n",
       " 2.6541562,\n",
       " 2.194595,\n",
       " 4.5861263,\n",
       " 3.2511275,\n",
       " 3.0983598,\n",
       " 2.4327266,\n",
       " 2.2431939,\n",
       " 2.1133213,\n",
       " 2.591357,\n",
       " 2.7012415,\n",
       " 2.3742044,\n",
       " 2.9440074,\n",
       " 3.9463382,\n",
       " 4.583214,\n",
       " 3.232881,\n",
       " 3.3535328,\n",
       " 5.1157174,\n",
       " 2.0959194,\n",
       " 1.7609929,\n",
       " 4.4489727,\n",
       " 2.7218015,\n",
       " 3.618015,\n",
       " 2.509173,\n",
       " 3.3541567,\n",
       " 4.6205454,\n",
       " 3.8185651,\n",
       " 8.553126,\n",
       " 4.899507,\n",
       " 2.3294947,\n",
       " 1.9417324,\n",
       " 7.095602,\n",
       " 3.0967,\n",
       " 3.6826508,\n",
       " 1.4285667,\n",
       " 3.5231931,\n",
       " 4.5831776,\n",
       " 5.3289227,\n",
       " 2.0882416,\n",
       " 2.433257,\n",
       " 1.9445779,\n",
       " 3.2811606,\n",
       " 4.691828,\n",
       " 2.175925,\n",
       " 4.162045,\n",
       " 3.6965804,\n",
       " 1.7029374,\n",
       " 3.3488183,\n",
       " 3.401385,\n",
       " 5.655991,\n",
       " 5.4708643,\n",
       " 3.0100021,\n",
       " 3.0742838,\n",
       " 2.8583426,\n",
       " 5.7102747,\n",
       " 5.0988507,\n",
       " 3.9713285,\n",
       " 2.1002848,\n",
       " 4.9759164,\n",
       " 2.1007316,\n",
       " 2.519694,\n",
       " 3.9114962,\n",
       " 4.700742,\n",
       " 2.7118118,\n",
       " 3.8664036,\n",
       " 3.8722503,\n",
       " 5.027083,\n",
       " 3.3911724,\n",
       " 1.8648552,\n",
       " 5.453354,\n",
       " 4.7357273,\n",
       " 3.4444582,\n",
       " 3.5087771,\n",
       " 3.1327925,\n",
       " 4.0422034,\n",
       " 3.2657435,\n",
       " 3.2583277,\n",
       " 3.7446399,\n",
       " 4.5679784,\n",
       " 3.3459132,\n",
       " 4.0539417,\n",
       " 2.2539687,\n",
       " 4.481001,\n",
       " 2.760824,\n",
       " 5.8032165,\n",
       " 4.5456142,\n",
       " 3.4213126,\n",
       " 4.3897386,\n",
       " 3.9701657,\n",
       " 3.943438,\n",
       " 4.6441035,\n",
       " 3.4218752,\n",
       " 5.0075264,\n",
       " 4.5611043,\n",
       " 2.3416197,\n",
       " 3.7431836,\n",
       " 4.0170283,\n",
       " 3.254621,\n",
       " 4.752709,\n",
       " 4.2592015,\n",
       " 4.3581886,\n",
       " 5.1106496,\n",
       " 3.5558221,\n",
       " 2.2048457,\n",
       " 2.268114,\n",
       " 5.040057,\n",
       " 3.24798,\n",
       " 4.4451003,\n",
       " 1.7871922,\n",
       " 4.1401196,\n",
       " 3.9842346,\n",
       " 3.986986,\n",
       " 3.0635004,\n",
       " 6.1265574,\n",
       " 4.611344,\n",
       " 4.0963926,\n",
       " 4.3433447,\n",
       " 6.5672398,\n",
       " 2.583012,\n",
       " 2.330296,\n",
       " 3.994644,\n",
       " 3.3212948,\n",
       " 3.1927392,\n",
       " 3.7562017,\n",
       " 4.2093897,\n",
       " 2.9301927,\n",
       " 2.7461257,\n",
       " 4.9055085,\n",
       " 3.7873852,\n",
       " 5.743454,\n",
       " 5.4898777,\n",
       " 4.1491733,\n",
       " 3.9833398,\n",
       " 5.7368436,\n",
       " 5.117223,\n",
       " 3.9936855,\n",
       " 5.3186526,\n",
       " 4.08269,\n",
       " 5.9017415,\n",
       " 3.8961585,\n",
       " 3.8329701,\n",
       " 3.5768936,\n",
       " 3.182377,\n",
       " 4.065773,\n",
       " 5.891185,\n",
       " 4.830745,\n",
       " 6.0906153,\n",
       " 3.4723563,\n",
       " 3.1999664,\n",
       " 3.5479994,\n",
       " 4.6189055,\n",
       " 1.8526273,\n",
       " 2.769998,\n",
       " 3.3698704,\n",
       " 4.747735,\n",
       " 4.3813624,\n",
       " 3.178469,\n",
       " 5.5720844,\n",
       " 2.9426863,\n",
       " 2.8653612,\n",
       " 4.9533205,\n",
       " 3.4447982,\n",
       " 3.8823843,\n",
       " 5.4314237,\n",
       " 3.7977011,\n",
       " 3.2016704,\n",
       " 3.6153417,\n",
       " 3.0784073,\n",
       " 6.343831,\n",
       " 2.7421649,\n",
       " 2.4986975,\n",
       " 4.949103,\n",
       " 5.037892,\n",
       " 4.3230205,\n",
       " 4.319677,\n",
       " 3.950736,\n",
       " 4.105207,\n",
       " 2.5190153,\n",
       " 4.813483,\n",
       " 4.4095488,\n",
       " 4.571061,\n",
       " 4.3267612,\n",
       " 4.6390657,\n",
       " 4.0282354,\n",
       " 2.0971978,\n",
       " 4.7242346,\n",
       " 4.8177843,\n",
       " 2.3789096,\n",
       " 3.4100628,\n",
       " 1.9280485,\n",
       " 4.2476892,\n",
       " 4.283513,\n",
       " 4.906113,\n",
       " 3.5042956,\n",
       " 2.1458666,\n",
       " 2.465351,\n",
       " 3.4673994,\n",
       " 5.2468047,\n",
       " 3.5524015,\n",
       " 4.8299093,\n",
       " 4.1602454,\n",
       " 3.5206103,\n",
       " 3.0280213,\n",
       " 5.1205864,\n",
       " 1.7236546,\n",
       " 3.6798627,\n",
       " 2.3194773,\n",
       " 3.2958763,\n",
       " 2.6334825,\n",
       " 2.3505335,\n",
       " 2.3460367,\n",
       " 3.6927762,\n",
       " 3.8510957,\n",
       " 6.029645,\n",
       " 4.370407,\n",
       " 6.6601186,\n",
       " 2.6707482,\n",
       " 2.992755,\n",
       " 4.797052,\n",
       " 3.973952,\n",
       " 3.215159,\n",
       " 4.280986,\n",
       " 2.0885193,\n",
       " 5.62983,\n",
       " 6.192882,\n",
       " 4.1224523,\n",
       " 2.608481,\n",
       " 5.007323,\n",
       " 3.9699478,\n",
       " 2.456148,\n",
       " 3.4412377,\n",
       " 3.5076528,\n",
       " 4.662217,\n",
       " 3.8592913,\n",
       " 3.1958277,\n",
       " 4.793657,\n",
       " 2.8350651,\n",
       " 5.2930183,\n",
       " 3.5731878,\n",
       " 4.6248116,\n",
       " 4.529588,\n",
       " 3.5690129,\n",
       " 5.8671193,\n",
       " 1.8556112,\n",
       " 4.007476,\n",
       " 3.6038563,\n",
       " 2.2934237,\n",
       " 3.339244,\n",
       " 2.662905,\n",
       " 4.7002826,\n",
       " 4.4321265,\n",
       " 3.5037355,\n",
       " 4.129247,\n",
       " 4.751649,\n",
       " 4.1295705,\n",
       " 4.264973,\n",
       " 3.091113,\n",
       " 3.0734494,\n",
       " 5.088879,\n",
       " 4.9103494,\n",
       " 2.3480835,\n",
       " 3.9936304,\n",
       " 2.3127954,\n",
       " 3.3348093,\n",
       " 3.3319352,\n",
       " 3.1266546,\n",
       " 5.9489822,\n",
       " 1.7999787,\n",
       " 2.012559,\n",
       " 2.1770728,\n",
       " 3.590851,\n",
       " 2.2069898,\n",
       " 3.4493563,\n",
       " 5.0647435,\n",
       " 3.992267,\n",
       " 3.0127292,\n",
       " 3.3342671,\n",
       " 3.1480482,\n",
       " 3.4067547,\n",
       " 4.8716626,\n",
       " 5.603233,\n",
       " 6.074116,\n",
       " 5.7474127,\n",
       " 3.9983225,\n",
       " 3.6283464,\n",
       " 3.8545291,\n",
       " 6.1243515,\n",
       " 3.8519213,\n",
       " 4.804683,\n",
       " 2.630086,\n",
       " 3.9737947,\n",
       " 3.6858423,\n",
       " 4.98838,\n",
       " 4.960894,\n",
       " 4.537942,\n",
       " 3.5040545,\n",
       " 3.7067955,\n",
       " 4.9238935,\n",
       " 4.173247,\n",
       " 6.227167,\n",
       " 2.2682116,\n",
       " 2.0702977,\n",
       " 3.8283255,\n",
       " 2.74771,\n",
       " 2.1695597,\n",
       " 4.7427807,\n",
       " 3.051143,\n",
       " 4.9758754,\n",
       " 6.3683624,\n",
       " 4.583194,\n",
       " 2.4767225,\n",
       " 2.400024,\n",
       " 2.408129,\n",
       " 2.6997983,\n",
       " 3.8698697,\n",
       " 2.7969615,\n",
       " 3.704413,\n",
       " 5.373021,\n",
       " 3.408398,\n",
       " 3.129535,\n",
       " 3.835675,\n",
       " 3.7684476,\n",
       " 2.8871236,\n",
       " 2.836891,\n",
       " 2.0888765,\n",
       " 5.9839334,\n",
       " 2.6734903,\n",
       " 2.0603113,\n",
       " 2.6954746,\n",
       " 6.00005,\n",
       " 5.308765,\n",
       " 6.3722677,\n",
       " 4.719781,\n",
       " 3.624764,\n",
       " 3.742368,\n",
       " 5.2255664,\n",
       " 3.3790112,\n",
       " 4.0538073,\n",
       " 2.9099665,\n",
       " 3.2916272,\n",
       " 6.8782587,\n",
       " 3.4595764,\n",
       " 4.578199,\n",
       " 3.3090343,\n",
       " 2.0596988,\n",
       " 5.3338614,\n",
       " 2.8022568,\n",
       " 4.790856,\n",
       " 2.990368,\n",
       " 2.8945162,\n",
       " 4.3812103,\n",
       " 4.4419312,\n",
       " 6.3055897,\n",
       " 7.129787,\n",
       " 2.806607,\n",
       " 4.395177,\n",
       " 3.3904946,\n",
       " 3.12413,\n",
       " 3.5116303,\n",
       " 3.4172132,\n",
       " 3.583791,\n",
       " 2.8879526,\n",
       " 3.5580325,\n",
       " 6.7617903,\n",
       " 2.2113135,\n",
       " 6.9820466,\n",
       " 4.683902,\n",
       " 7.104758,\n",
       " 4.262261,\n",
       " 4.4762897,\n",
       " 4.9482946,\n",
       " 4.7700744,\n",
       " 3.5656624,\n",
       " 5.7263317,\n",
       " 2.0947587,\n",
       " 4.826623,\n",
       " 5.7826834,\n",
       " 1.1903187,\n",
       " 9.917903,\n",
       " 2.9980972,\n",
       " 4.8576603,\n",
       " 3.8977854,\n",
       " 3.0103326,\n",
       " 4.556766,\n",
       " 2.7785363,\n",
       " 3.104996,\n",
       " 5.0518064,\n",
       " 3.2928526,\n",
       " 4.898923,\n",
       " 1.9452668,\n",
       " 5.0449147,\n",
       " 4.6234736,\n",
       " 3.1694589,\n",
       " 3.0619588,\n",
       " 4.6304545,\n",
       " 3.203464,\n",
       " 1.5001714,\n",
       " 3.3704226,\n",
       " 6.6077833,\n",
       " 5.943845,\n",
       " 2.9990335,\n",
       " 4.5981507,\n",
       " 4.7551937,\n",
       " 3.0479116,\n",
       " 3.1251047,\n",
       " 3.879999,\n",
       " 2.8934667,\n",
       " 5.3904986,\n",
       " 3.061696,\n",
       " 5.3210874,\n",
       " 2.3905156,\n",
       " 4.2668085,\n",
       " 4.7398963,\n",
       " 2.5062165,\n",
       " 4.2574854,\n",
       " 3.5735283,\n",
       " 4.88452,\n",
       " 2.3094568,\n",
       " 4.5930223,\n",
       " 3.631697,\n",
       " 4.2240973,\n",
       " 5.0976324,\n",
       " 6.5562277,\n",
       " 6.285596,\n",
       " 2.769055,\n",
       " 5.864918,\n",
       " 5.313547,\n",
       " 5.3543344,\n",
       " 4.130839,\n",
       " 5.348893,\n",
       " 6.48132,\n",
       " 6.0209565,\n",
       " 3.034349,\n",
       " 3.6436713,\n",
       " 1.8207237,\n",
       " 5.174815,\n",
       " 4.15094,\n",
       " 3.5065455,\n",
       " 6.2430153,\n",
       " 2.2250364,\n",
       " 4.0776463,\n",
       " 5.0063386,\n",
       " 5.3476286,\n",
       " 5.8454566,\n",
       " 3.3712125,\n",
       " 4.2486987,\n",
       " 4.5469465,\n",
       " 3.4013572,\n",
       " 6.2778687,\n",
       " 2.4304354,\n",
       " 3.273569,\n",
       " 5.931066,\n",
       " 4.5124946,\n",
       " 2.3586283,\n",
       " 4.3608556,\n",
       " 3.003724,\n",
       " 4.784258,\n",
       " 6.5375657,\n",
       " 2.952287,\n",
       " 3.1453338,\n",
       " 2.2674165,\n",
       " 4.387846,\n",
       " 3.9196787,\n",
       " 2.7146413,\n",
       " 3.2874033,\n",
       " 2.438734,\n",
       " 4.515939,\n",
       " 3.250508,\n",
       " 1.753925,\n",
       " 3.2595718,\n",
       " 3.041656,\n",
       " 4.6719646,\n",
       " 3.6991413,\n",
       " 5.4171214,\n",
       " 2.3224466,\n",
       " 3.3424,\n",
       " 3.1478493,\n",
       " 5.068537,\n",
       " 4.939534,\n",
       " 3.8296442,\n",
       " 3.8163161,\n",
       " 3.9627657,\n",
       " 2.707228,\n",
       " 2.7350016,\n",
       " 3.825189,\n",
       " 4.1058235,\n",
       " 3.9237118,\n",
       " 3.1207416,\n",
       " 4.2855535,\n",
       " 4.8967247,\n",
       " 3.4325469,\n",
       " 4.5378604,\n",
       " 3.8468802,\n",
       " 6.5111256,\n",
       " 2.039206,\n",
       " 7.067199,\n",
       " 3.571178,\n",
       " ...]"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ALH_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "id": "3aabed6c",
   "metadata": {},
   "outputs": [],
   "source": [
    "del stat_df[\"ALH\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "id": "1826a45d",
   "metadata": {},
   "outputs": [],
   "source": [
    "stat_df[\"ALH\"] = ALH_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "id": "9c84185f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4.276645"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stat_df[\"ALH\"][0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "id": "9b18fbd6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>date</th>\n",
       "      <th>quantity</th>\n",
       "      <th>exposure</th>\n",
       "      <th>tracked_id</th>\n",
       "      <th>traj</th>\n",
       "      <th>VCL</th>\n",
       "      <th>VAP</th>\n",
       "      <th>VSL</th>\n",
       "      <th>LIN</th>\n",
       "      <th>STR</th>\n",
       "      <th>WOB</th>\n",
       "      <th>BeatCross</th>\n",
       "      <th>ALH</th>\n",
       "      <th>img</th>\n",
       "      <th>cluster</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3538</th>\n",
       "      <td>balder</td>\n",
       "      <td>10032020-27</td>\n",
       "      <td>1u</td>\n",
       "      <td>30.0</td>\n",
       "      <td>94.0</td>\n",
       "      <td>[[526, 526, 525, 527, 526, 525, 527, 526, 526,...</td>\n",
       "      <td>68.77144</td>\n",
       "      <td>31.967293</td>\n",
       "      <td>30.26791</td>\n",
       "      <td>0.440123</td>\n",
       "      <td>0.94684</td>\n",
       "      <td>0.464834</td>\n",
       "      <td>32.19512</td>\n",
       "      <td>2.7122898.</td>\n",
       "      <td>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        name         date quantity  exposure  tracked_id  \\\n",
       "3538  balder  10032020-27       1u      30.0        94.0   \n",
       "\n",
       "                                                   traj       VCL        VAP  \\\n",
       "3538  [[526, 526, 525, 527, 526, 525, 527, 526, 526,...  68.77144  31.967293   \n",
       "\n",
       "           VSL       LIN      STR       WOB  BeatCross          ALH  \\\n",
       "3538  30.26791  0.440123  0.94684  0.464834   32.19512  2.7122898.    \n",
       "\n",
       "                                                    img  cluster  \n",
       "3538  [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ...        5  "
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stat_df.loc[stat_df[\"ALH\"] == '2.7122898. ']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "id": "ad4e930b",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/tmp/ipykernel_79147/267844632.py:1: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  stat_df[\"ALH\"][3538] =2.7122898\n"
     ]
    }
   ],
   "source": [
    "#stat_df[\"ALH\"][3538] =2.7122898"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "id": "996d31b1",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "n_clusters = 6\n",
    "clusters_array = np.arange(n_clusters)\n",
    "exposure = [0.0, 30.0]\n",
    "quantity = [\"0\", \"100n\", \"10n\", \"1u\"]\n",
    "\n",
    "cluster_list = []\n",
    "labels_list = []\n",
    "for c in clusters_array:\n",
    "    cluster_i = stat_df[stat_df[\"cluster\"]==c]\n",
    "    for e in exposure:\n",
    "        cluster_j = cluster_i[cluster_i[\"exposure\"]==e]\n",
    "        for q in quantity:\n",
    "            cluster_k = cluster_j[cluster_j[\"quantity\"]==q]\n",
    "            cluster_list.append(cluster_k)\n",
    "            labels = [str(c), str(e), q]\n",
    "            labels_list.append(labels)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "id": "bc878309",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['0', '0.0', '0']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    146.667453\n",
      "VCL            92.466224\n",
      "VAP            49.143484\n",
      "VSL            37.381165\n",
      "LIN             0.417778\n",
      "STR             0.757631\n",
      "WOB             0.538967\n",
      "BeatCross      37.544176\n",
      "cluster         0.000000\n",
      "ALH             3.715009\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    120.190788\n",
      "VCL            31.185755\n",
      "VAP            17.171348\n",
      "VSL            18.126750\n",
      "LIN             0.176388\n",
      "STR             0.212865\n",
      "WOB             0.124806\n",
      "BeatCross       5.895184\n",
      "cluster         0.000000\n",
      "ALH             1.254470\n",
      "dtype: float64\n",
      "['0', '0.0', '100n']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    115.760000\n",
      "VCL            94.818243\n",
      "VAP            49.097656\n",
      "VSL            37.459986\n",
      "LIN             0.415238\n",
      "STR             0.764583\n",
      "WOB             0.531401\n",
      "BeatCross      38.083050\n",
      "cluster         0.000000\n",
      "ALH             3.806654\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    80.600392\n",
      "VCL           40.028532\n",
      "VAP           20.063869\n",
      "VSL           19.388919\n",
      "LIN            0.170639\n",
      "STR            0.210213\n",
      "WOB            0.121781\n",
      "BeatCross      5.772907\n",
      "cluster        0.000000\n",
      "ALH            1.564395\n",
      "dtype: float64\n",
      "['0', '0.0', '10n']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    144.464115\n",
      "VCL            97.004630\n",
      "VAP            51.724288\n",
      "VSL            40.398463\n",
      "LIN             0.433026\n",
      "STR             0.776430\n",
      "WOB             0.544041\n",
      "BeatCross      36.702875\n",
      "cluster         0.000000\n",
      "ALH             3.929963\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    103.707409\n",
      "VCL            37.946952\n",
      "VAP            20.120954\n",
      "VSL            20.107080\n",
      "LIN             0.169100\n",
      "STR             0.193333\n",
      "WOB             0.123096\n",
      "BeatCross       5.903765\n",
      "cluster         0.000000\n",
      "ALH             1.531113\n",
      "dtype: float64\n",
      "['0', '0.0', '1u']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    144.145773\n",
      "VCL           109.126533\n",
      "VAP            57.112053\n",
      "VSL            40.943647\n",
      "LIN             0.402134\n",
      "STR             0.717067\n",
      "WOB             0.540202\n",
      "BeatCross      37.338116\n",
      "cluster         0.000000\n",
      "ALH             4.326080\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    106.654880\n",
      "VCL            41.386603\n",
      "VAP            19.908691\n",
      "VSL            20.942472\n",
      "LIN             0.198411\n",
      "STR             0.242903\n",
      "WOB             0.132362\n",
      "BeatCross       5.654009\n",
      "cluster         0.000000\n",
      "ALH             1.520631\n",
      "dtype: float64\n",
      "['0', '30.0', '0']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    121.694118\n",
      "VCL            86.286793\n",
      "VAP            51.393833\n",
      "VSL            45.440366\n",
      "LIN             0.526857\n",
      "STR             0.875639\n",
      "WOB             0.594796\n",
      "BeatCross      37.395119\n",
      "cluster         0.000000\n",
      "ALH             3.655031\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    94.411917\n",
      "VCL           29.060709\n",
      "VAP           19.956383\n",
      "VSL           19.613516\n",
      "LIN            0.149047\n",
      "STR            0.118705\n",
      "WOB            0.126797\n",
      "BeatCross      5.981075\n",
      "cluster        0.000000\n",
      "ALH            1.331000\n",
      "dtype: float64\n",
      "['0', '30.0', '100n']\n",
      "mean\n",
      " exposure      30.000000\n",
      "tracked_id    96.795154\n",
      "VCL           88.612772\n",
      "VAP           49.044939\n",
      "VSL           40.906647\n",
      "LIN            0.467332\n",
      "STR            0.827326\n",
      "WOB            0.556651\n",
      "BeatCross     38.160934\n",
      "cluster        0.000000\n",
      "ALH            3.615912\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    58.662878\n",
      "VCL           32.866652\n",
      "VAP           20.553582\n",
      "VSL           19.782268\n",
      "LIN            0.150422\n",
      "STR            0.151532\n",
      "WOB            0.122589\n",
      "BeatCross      5.799893\n",
      "cluster        0.000000\n",
      "ALH            1.432393\n",
      "dtype: float64\n",
      "['0', '30.0', '10n']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    111.723618\n",
      "VCL            84.319253\n",
      "VAP            49.439150\n",
      "VSL            42.009389\n",
      "LIN             0.501624\n",
      "STR             0.848150\n",
      "WOB             0.584921\n",
      "BeatCross      37.564285\n",
      "cluster         0.000000\n",
      "ALH             3.567062\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    86.847700\n",
      "VCL           28.898179\n",
      "VAP           19.519866\n",
      "VSL           18.764756\n",
      "LIN            0.149305\n",
      "STR            0.143669\n",
      "WOB            0.118832\n",
      "BeatCross      5.958602\n",
      "cluster        0.000000\n",
      "ALH            1.323341\n",
      "dtype: float64\n",
      "['0', '30.0', '1u']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    136.394161\n",
      "VCL            93.255354\n",
      "VAP            53.100562\n",
      "VSL            44.185280\n",
      "LIN             0.481528\n",
      "STR             0.821475\n",
      "WOB             0.575199\n",
      "BeatCross      36.245716\n",
      "cluster         0.000000\n",
      "ALH             3.880585\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    96.855514\n",
      "VCL           36.121386\n",
      "VAP           22.428717\n",
      "VSL           22.154441\n",
      "LIN            0.168602\n",
      "STR            0.154772\n",
      "WOB            0.136330\n",
      "BeatCross      6.540562\n",
      "cluster        0.000000\n",
      "ALH            1.561421\n",
      "dtype: float64\n",
      "['1', '0.0', '0']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    101.441379\n",
      "VCL           100.763978\n",
      "VAP            58.763474\n",
      "VSL            37.226005\n",
      "LIN             0.384359\n",
      "STR             0.640290\n",
      "WOB             0.592344\n",
      "BeatCross      39.400140\n",
      "cluster         1.000000\n",
      "ALH             4.138271\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    77.214850\n",
      "VCL           27.552926\n",
      "VAP           15.044891\n",
      "VSL           14.766326\n",
      "LIN            0.147302\n",
      "STR            0.195745\n",
      "WOB            0.095149\n",
      "BeatCross      4.422623\n",
      "cluster        0.000000\n",
      "ALH            1.084277\n",
      "dtype: float64\n",
      "['1', '0.0', '100n']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id     86.065789\n",
      "VCL           109.730955\n",
      "VAP            61.518547\n",
      "VSL            37.014904\n",
      "LIN             0.362082\n",
      "STR             0.619228\n",
      "WOB             0.577871\n",
      "BeatCross      39.571819\n",
      "cluster         1.000000\n",
      "ALH             4.423665\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    64.489202\n",
      "VCL           41.247196\n",
      "VAP           18.862612\n",
      "VSL           16.217808\n",
      "LIN            0.149451\n",
      "STR            0.213639\n",
      "WOB            0.091652\n",
      "BeatCross      4.251265\n",
      "cluster        0.000000\n",
      "ALH            1.519738\n",
      "dtype: float64\n",
      "['1', '0.0', '10n']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    100.419660\n",
      "VCL           111.708745\n",
      "VAP            62.888145\n",
      "VSL            38.036782\n",
      "LIN             0.363193\n",
      "STR             0.615740\n",
      "WOB             0.578608\n",
      "BeatCross      39.127028\n",
      "cluster         1.000000\n",
      "ALH             4.518989\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    73.588367\n",
      "VCL           37.955983\n",
      "VAP           18.267754\n",
      "VSL           16.801327\n",
      "LIN            0.156152\n",
      "STR            0.208883\n",
      "WOB            0.098599\n",
      "BeatCross      4.751705\n",
      "cluster        0.000000\n",
      "ALH            1.457116\n",
      "dtype: float64\n",
      "['1', '0.0', '1u']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    106.515658\n",
      "VCL           124.636830\n",
      "VAP            68.437567\n",
      "VSL            40.877496\n",
      "LIN             0.360322\n",
      "STR             0.610557\n",
      "WOB             0.570224\n",
      "BeatCross      39.348745\n",
      "cluster         1.000000\n",
      "ALH             4.946608\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    77.566244\n",
      "VCL           47.558429\n",
      "VAP           21.595268\n",
      "VSL           18.614467\n",
      "LIN            0.179724\n",
      "STR            0.221714\n",
      "WOB            0.114898\n",
      "BeatCross      4.524672\n",
      "cluster        0.000000\n",
      "ALH            1.689590\n",
      "dtype: float64\n",
      "['1', '30.0', '0']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    102.831776\n",
      "VCL           101.000180\n",
      "VAP            63.407727\n",
      "VSL            46.214785\n",
      "LIN             0.478954\n",
      "STR             0.733299\n",
      "WOB             0.642828\n",
      "BeatCross      39.240955\n",
      "cluster         1.000000\n",
      "ALH             4.248302\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    83.943271\n",
      "VCL           37.254707\n",
      "VAP           19.949255\n",
      "VSL           18.838891\n",
      "LIN            0.159755\n",
      "STR            0.181355\n",
      "WOB            0.104511\n",
      "BeatCross      5.092626\n",
      "cluster        0.000000\n",
      "ALH            1.416525\n",
      "dtype: float64\n",
      "['1', '30.0', '100n']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id     79.877069\n",
      "VCL           106.599431\n",
      "VAP            62.561544\n",
      "VSL            40.993536\n",
      "LIN             0.402673\n",
      "STR             0.665056\n",
      "WOB             0.599273\n",
      "BeatCross      39.729743\n",
      "cluster         1.000000\n",
      "ALH             4.371819\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    51.033620\n",
      "VCL           35.337564\n",
      "VAP           18.674282\n",
      "VSL           16.783978\n",
      "LIN            0.141998\n",
      "STR            0.188128\n",
      "WOB            0.095696\n",
      "BeatCross      4.584232\n",
      "cluster        0.000000\n",
      "ALH            1.369786\n",
      "dtype: float64\n",
      "['1', '30.0', '10n']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id     77.645777\n",
      "VCL           102.458785\n",
      "VAP            63.075017\n",
      "VSL            41.421549\n",
      "LIN             0.427965\n",
      "STR             0.673256\n",
      "WOB             0.627553\n",
      "BeatCross      39.238701\n",
      "cluster         1.000000\n",
      "ALH             4.280053\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    58.641682\n",
      "VCL           34.067034\n",
      "VAP           18.680582\n",
      "VSL           15.969644\n",
      "LIN            0.158185\n",
      "STR            0.198179\n",
      "WOB            0.098805\n",
      "BeatCross      4.814522\n",
      "cluster        0.000000\n",
      "ALH            1.343056\n",
      "dtype: float64\n",
      "['1', '30.0', '1u']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    116.874355\n",
      "VCL           111.817037\n",
      "VAP            66.566991\n",
      "VSL            45.665888\n",
      "LIN             0.426782\n",
      "STR             0.687410\n",
      "WOB             0.610937\n",
      "BeatCross      38.676823\n",
      "cluster         1.000000\n",
      "ALH             4.638503\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    80.226982\n",
      "VCL           39.450614\n",
      "VAP           20.663911\n",
      "VSL           19.456648\n",
      "LIN            0.153050\n",
      "STR            0.183382\n",
      "WOB            0.100840\n",
      "BeatCross      4.619412\n",
      "cluster        0.000000\n",
      "ALH            1.575066\n",
      "dtype: float64\n",
      "['2', '0.0', '0']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    256.781250\n",
      "VCL            78.762480\n",
      "VAP            36.156790\n",
      "VSL            31.712432\n",
      "LIN             0.403107\n",
      "STR             0.862013\n",
      "WOB             0.458578\n",
      "BeatCross      34.212924\n",
      "cluster         2.000000\n",
      "ALH             3.073463\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    181.259753\n",
      "VCL            23.216335\n",
      "VAP            16.037111\n",
      "VSL            16.006593\n",
      "LIN             0.160476\n",
      "STR             0.120250\n",
      "WOB             0.149078\n",
      "BeatCross       6.737128\n",
      "cluster         0.000000\n",
      "ALH             1.142352\n",
      "dtype: float64\n",
      "['2', '0.0', '100n']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    146.725441\n",
      "VCL            77.007868\n",
      "VAP            36.914926\n",
      "VSL            32.941311\n",
      "LIN             0.425211\n",
      "STR             0.875238\n",
      "WOB             0.475938\n",
      "BeatCross      35.863765\n",
      "cluster         2.000000\n",
      "ALH             2.990524\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    98.888176\n",
      "VCL           25.569370\n",
      "VAP           17.923374\n",
      "VSL           17.694639\n",
      "LIN            0.167369\n",
      "STR            0.110839\n",
      "WOB            0.154743\n",
      "BeatCross      6.870996\n",
      "cluster        0.000000\n",
      "ALH            1.199707\n",
      "dtype: float64\n",
      "['2', '0.0', '10n']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    160.719376\n",
      "VCL            79.021906\n",
      "VAP            38.623554\n",
      "VSL            34.109328\n",
      "LIN             0.447038\n",
      "STR             0.872775\n",
      "WOB             0.500804\n",
      "BeatCross      34.050652\n",
      "cluster         2.000000\n",
      "ALH             3.187760\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    110.681257\n",
      "VCL            29.796223\n",
      "VAP            17.813732\n",
      "VSL            17.390927\n",
      "LIN             0.189822\n",
      "STR             0.121972\n",
      "WOB             0.176011\n",
      "BeatCross       6.945281\n",
      "cluster         0.000000\n",
      "ALH             1.318758\n",
      "dtype: float64\n",
      "['2', '0.0', '1u']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    185.900000\n",
      "VCL            85.694331\n",
      "VAP            43.992781\n",
      "VSL            39.411809\n",
      "LIN             0.468622\n",
      "STR             0.878827\n",
      "WOB             0.519957\n",
      "BeatCross      33.807392\n",
      "cluster         2.000000\n",
      "ALH             3.489836\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    123.014884\n",
      "VCL            30.808953\n",
      "VAP            19.421640\n",
      "VSL            19.417059\n",
      "LIN             0.191516\n",
      "STR             0.125115\n",
      "WOB             0.174264\n",
      "BeatCross       6.964380\n",
      "cluster         0.000000\n",
      "ALH             1.385157\n",
      "dtype: float64\n",
      "['2', '30.0', '0']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    151.382231\n",
      "VCL            77.933573\n",
      "VAP            41.235673\n",
      "VSL            37.272327\n",
      "LIN             0.474543\n",
      "STR             0.887882\n",
      "WOB             0.524823\n",
      "BeatCross      35.270344\n",
      "cluster         2.000000\n",
      "ALH             3.167795\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    107.236029\n",
      "VCL            24.073956\n",
      "VAP            18.999621\n",
      "VSL            18.785456\n",
      "LIN             0.180224\n",
      "STR             0.110091\n",
      "WOB             0.167763\n",
      "BeatCross       6.941730\n",
      "cluster         0.000000\n",
      "ALH             1.191163\n",
      "dtype: float64\n",
      "['2', '30.0', '100n']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    109.504425\n",
      "VCL            73.112179\n",
      "VAP            34.761519\n",
      "VSL            31.526339\n",
      "LIN             0.429880\n",
      "STR             0.891073\n",
      "WOB             0.473619\n",
      "BeatCross      36.550072\n",
      "cluster         2.000000\n",
      "ALH             2.847375\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    61.316203\n",
      "VCL           21.339934\n",
      "VAP           15.709547\n",
      "VSL           15.627820\n",
      "LIN            0.164578\n",
      "STR            0.091669\n",
      "WOB            0.154824\n",
      "BeatCross      6.972957\n",
      "cluster        0.000000\n",
      "ALH            1.043787\n",
      "dtype: float64\n",
      "['2', '30.0', '10n']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    137.988558\n",
      "VCL            71.098110\n",
      "VAP            36.448968\n",
      "VSL            33.132116\n",
      "LIN             0.461783\n",
      "STR             0.898925\n",
      "WOB             0.507405\n",
      "BeatCross      35.654389\n",
      "cluster         2.000000\n",
      "ALH             2.875004\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    99.647693\n",
      "VCL           22.430889\n",
      "VAP           16.942077\n",
      "VSL           16.676703\n",
      "LIN            0.165165\n",
      "STR            0.098589\n",
      "WOB            0.156008\n",
      "BeatCross      6.930568\n",
      "cluster        0.000000\n",
      "ALH            1.153699\n",
      "dtype: float64\n",
      "['2', '30.0', '1u']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    153.246120\n",
      "VCL            78.938805\n",
      "VAP            40.630978\n",
      "VSL            36.615556\n",
      "LIN             0.464969\n",
      "STR             0.884431\n",
      "WOB             0.516065\n",
      "BeatCross      33.312428\n",
      "cluster         2.000000\n",
      "ALH             3.181406\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    104.709691\n",
      "VCL            25.187451\n",
      "VAP            18.097799\n",
      "VSL            18.092708\n",
      "LIN             0.176027\n",
      "STR             0.102686\n",
      "WOB             0.165301\n",
      "BeatCross       7.214422\n",
      "cluster         0.000000\n",
      "ALH             1.225732\n",
      "dtype: float64\n",
      "['3', '0.0', '0']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    176.338673\n",
      "VCL            86.603556\n",
      "VAP            46.141427\n",
      "VSL            38.706816\n",
      "LIN             0.454251\n",
      "STR             0.829091\n",
      "WOB             0.538591\n",
      "BeatCross      36.700986\n",
      "cluster         3.000000\n",
      "ALH             3.338725\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    135.288189\n",
      "VCL            25.615151\n",
      "VAP            15.608165\n",
      "VSL            15.992469\n",
      "LIN             0.156999\n",
      "STR             0.148092\n",
      "WOB             0.131031\n",
      "BeatCross       6.154557\n",
      "cluster         0.000000\n",
      "ALH             1.035025\n",
      "dtype: float64\n",
      "['3', '0.0', '100n']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    117.454861\n",
      "VCL            88.937370\n",
      "VAP            44.392022\n",
      "VSL            37.775762\n",
      "LIN             0.437767\n",
      "STR             0.844570\n",
      "WOB             0.508799\n",
      "BeatCross      37.752899\n",
      "cluster         3.000000\n",
      "ALH             3.304941\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    79.817680\n",
      "VCL           35.380461\n",
      "VAP           17.939433\n",
      "VSL           17.080720\n",
      "LIN            0.147604\n",
      "STR            0.131818\n",
      "WOB            0.123935\n",
      "BeatCross      5.805591\n",
      "cluster        0.000000\n",
      "ALH            1.338051\n",
      "dtype: float64\n",
      "['3', '0.0', '10n']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    135.574545\n",
      "VCL            87.825964\n",
      "VAP            46.223973\n",
      "VSL            38.981547\n",
      "LIN             0.454161\n",
      "STR             0.832975\n",
      "WOB             0.535628\n",
      "BeatCross      37.017248\n",
      "cluster         3.000000\n",
      "ALH             3.308846\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    105.585874\n",
      "VCL            33.181759\n",
      "VAP            17.981772\n",
      "VSL            17.495126\n",
      "LIN             0.156579\n",
      "STR             0.143814\n",
      "WOB             0.133365\n",
      "BeatCross       6.252358\n",
      "cluster         0.000000\n",
      "ALH             1.203779\n",
      "dtype: float64\n",
      "['3', '0.0', '1u']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    144.262987\n",
      "VCL           100.444076\n",
      "VAP            51.460751\n",
      "VSL            42.161017\n",
      "LIN             0.433764\n",
      "STR             0.803575\n",
      "WOB             0.523299\n",
      "BeatCross      36.239796\n",
      "cluster         3.000000\n",
      "ALH             3.772725\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    100.194399\n",
      "VCL            35.984101\n",
      "VAP            19.989756\n",
      "VSL            20.414390\n",
      "LIN             0.175826\n",
      "STR             0.168362\n",
      "WOB             0.140973\n",
      "BeatCross       6.167020\n",
      "cluster         0.000000\n",
      "ALH             1.532687\n",
      "dtype: float64\n",
      "['3', '30.0', '0']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    144.126923\n",
      "VCL            84.492525\n",
      "VAP            50.769482\n",
      "VSL            46.586633\n",
      "LIN             0.550372\n",
      "STR             0.906619\n",
      "WOB             0.600900\n",
      "BeatCross      36.154847\n",
      "cluster         3.000000\n",
      "ALH             3.240738\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    98.327889\n",
      "VCL           28.435417\n",
      "VAP           20.460197\n",
      "VSL           20.204258\n",
      "LIN            0.147742\n",
      "STR            0.082549\n",
      "WOB            0.134272\n",
      "BeatCross      6.610582\n",
      "cluster        0.000000\n",
      "ALH            1.159159\n",
      "dtype: float64\n",
      "['3', '30.0', '100n']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    100.497817\n",
      "VCL            89.630000\n",
      "VAP            46.580800\n",
      "VSL            40.194801\n",
      "LIN             0.450841\n",
      "STR             0.849197\n",
      "WOB             0.522177\n",
      "BeatCross      38.148546\n",
      "cluster         3.000000\n",
      "ALH             3.497919\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    59.650122\n",
      "VCL           33.571024\n",
      "VAP           20.123956\n",
      "VSL           19.624805\n",
      "LIN            0.148093\n",
      "STR            0.123250\n",
      "WOB            0.129942\n",
      "BeatCross      5.836599\n",
      "cluster        0.000000\n",
      "ALH            1.419647\n",
      "dtype: float64\n",
      "['3', '30.0', '10n']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    135.995614\n",
      "VCL            83.187021\n",
      "VAP            47.078258\n",
      "VSL            41.922221\n",
      "LIN             0.502589\n",
      "STR             0.880972\n",
      "WOB             0.564086\n",
      "BeatCross      37.029364\n",
      "cluster         3.000000\n",
      "ALH             3.205745\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    93.456980\n",
      "VCL           27.816056\n",
      "VAP           19.028659\n",
      "VSL           18.617173\n",
      "LIN            0.142942\n",
      "STR            0.096430\n",
      "WOB            0.128856\n",
      "BeatCross      6.439832\n",
      "cluster        0.000000\n",
      "ALH            1.148842\n",
      "dtype: float64\n",
      "['3', '30.0', '1u']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    138.975207\n",
      "VCL            86.927099\n",
      "VAP            49.095958\n",
      "VSL            42.680212\n",
      "LIN             0.493719\n",
      "STR             0.855264\n",
      "WOB             0.569172\n",
      "BeatCross      36.389267\n",
      "cluster         3.000000\n",
      "ALH             3.281421\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    94.355817\n",
      "VCL           29.925764\n",
      "VAP           18.871321\n",
      "VSL           18.709431\n",
      "LIN            0.148835\n",
      "STR            0.113813\n",
      "WOB            0.129583\n",
      "BeatCross      5.710536\n",
      "cluster        0.000000\n",
      "ALH            1.190537\n",
      "dtype: float64\n",
      "['4', '0.0', '0']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    246.136424\n",
      "VCL            78.099718\n",
      "VAP            37.066343\n",
      "VSL            32.501016\n",
      "LIN             0.419698\n",
      "STR             0.862988\n",
      "WOB             0.476523\n",
      "BeatCross      33.753260\n",
      "cluster         4.000000\n",
      "ALH             3.078611\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    171.530654\n",
      "VCL            24.766454\n",
      "VAP            16.731631\n",
      "VSL            16.552013\n",
      "LIN             0.170113\n",
      "STR             0.120727\n",
      "WOB             0.157844\n",
      "BeatCross       6.943080\n",
      "cluster         0.000000\n",
      "ALH             1.159318\n",
      "dtype: float64\n",
      "['4', '0.0', '100n']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    141.673469\n",
      "VCL            78.792583\n",
      "VAP            36.041518\n",
      "VSL            31.638740\n",
      "LIN             0.402188\n",
      "STR             0.859991\n",
      "WOB             0.456744\n",
      "BeatCross      34.418248\n",
      "cluster         4.000000\n",
      "ALH             3.139940\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    98.705354\n",
      "VCL           23.663697\n",
      "VAP           17.763200\n",
      "VSL           17.663055\n",
      "LIN            0.182724\n",
      "STR            0.128238\n",
      "WOB            0.171351\n",
      "BeatCross      7.380308\n",
      "cluster        0.000000\n",
      "ALH            1.172642\n",
      "dtype: float64\n",
      "['4', '0.0', '10n']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    163.246418\n",
      "VCL            80.181688\n",
      "VAP            37.658041\n",
      "VSL            32.381961\n",
      "LIN             0.411007\n",
      "STR             0.845697\n",
      "WOB             0.473805\n",
      "BeatCross      34.478515\n",
      "cluster         4.000000\n",
      "ALH             3.182097\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    110.298144\n",
      "VCL            27.817669\n",
      "VAP            17.070454\n",
      "VSL            16.919195\n",
      "LIN             0.177141\n",
      "STR             0.142274\n",
      "WOB             0.160581\n",
      "BeatCross       7.158175\n",
      "cluster         0.000000\n",
      "ALH             1.237935\n",
      "dtype: float64\n",
      "['4', '0.0', '1u']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    173.083933\n",
      "VCL            85.040153\n",
      "VAP            41.373642\n",
      "VSL            36.061763\n",
      "LIN             0.431064\n",
      "STR             0.853848\n",
      "WOB             0.490757\n",
      "BeatCross      33.886496\n",
      "cluster         4.000000\n",
      "ALH             3.416716\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    112.744564\n",
      "VCL            32.380463\n",
      "VAP            20.267040\n",
      "VSL            19.908957\n",
      "LIN             0.189246\n",
      "STR             0.136431\n",
      "WOB             0.173914\n",
      "BeatCross       6.755006\n",
      "cluster         0.000000\n",
      "ALH             1.392576\n",
      "dtype: float64\n",
      "['4', '30.0', '0']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    150.503386\n",
      "VCL            75.770258\n",
      "VAP            39.711923\n",
      "VSL            35.867728\n",
      "LIN             0.467966\n",
      "STR             0.887079\n",
      "WOB             0.517998\n",
      "BeatCross      34.848493\n",
      "cluster         4.000000\n",
      "ALH             3.103231\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    105.194291\n",
      "VCL            23.464800\n",
      "VAP            18.930991\n",
      "VSL            18.859196\n",
      "LIN             0.179817\n",
      "STR             0.107214\n",
      "WOB             0.167138\n",
      "BeatCross       6.773386\n",
      "cluster         0.000000\n",
      "ALH             1.195038\n",
      "dtype: float64\n",
      "['4', '30.0', '100n']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    112.442897\n",
      "VCL            76.964633\n",
      "VAP            37.032670\n",
      "VSL            33.043931\n",
      "LIN             0.432601\n",
      "STR             0.876043\n",
      "WOB             0.483786\n",
      "BeatCross      35.674333\n",
      "cluster         4.000000\n",
      "ALH             3.065932\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    62.242869\n",
      "VCL           25.227591\n",
      "VAP           16.942032\n",
      "VSL           16.917333\n",
      "LIN            0.170271\n",
      "STR            0.119041\n",
      "WOB            0.158199\n",
      "BeatCross      6.942939\n",
      "cluster        0.000000\n",
      "ALH            1.152643\n",
      "dtype: float64\n",
      "['4', '30.0', '10n']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    146.038217\n",
      "VCL            75.237213\n",
      "VAP            40.459428\n",
      "VSL            36.808056\n",
      "LIN             0.478822\n",
      "STR             0.892529\n",
      "WOB             0.527963\n",
      "BeatCross      34.999278\n",
      "cluster         4.000000\n",
      "ALH             3.191631\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    100.453533\n",
      "VCL            22.734979\n",
      "VAP            20.063425\n",
      "VSL            19.766268\n",
      "LIN             0.179133\n",
      "STR             0.095799\n",
      "WOB             0.171255\n",
      "BeatCross       6.797758\n",
      "cluster         0.000000\n",
      "ALH             1.273233\n",
      "dtype: float64\n",
      "['4', '30.0', '1u']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    154.032468\n",
      "VCL            77.826760\n",
      "VAP            39.935774\n",
      "VSL            36.042681\n",
      "LIN             0.469449\n",
      "STR             0.884752\n",
      "WOB             0.518696\n",
      "BeatCross      33.624410\n",
      "cluster         4.000000\n",
      "ALH             3.228990\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    108.765589\n",
      "VCL            25.997125\n",
      "VAP            18.724041\n",
      "VSL            18.627616\n",
      "LIN             0.185067\n",
      "STR             0.103167\n",
      "WOB             0.173531\n",
      "BeatCross       7.998893\n",
      "cluster         0.000000\n",
      "ALH             1.261336\n",
      "dtype: float64\n",
      "['5', '0.0', '0']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    233.418410\n",
      "VCL            80.046197\n",
      "VAP            38.650275\n",
      "VSL            33.681078\n",
      "LIN             0.422398\n",
      "STR             0.858775\n",
      "WOB             0.482286\n",
      "BeatCross      34.977578\n",
      "cluster         5.000000\n",
      "ALH             3.000715\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    167.920019\n",
      "VCL            22.093151\n",
      "VAP            16.119693\n",
      "VSL            16.315877\n",
      "LIN             0.165848\n",
      "STR             0.135860\n",
      "WOB             0.149861\n",
      "BeatCross       6.583457\n",
      "cluster         0.000000\n",
      "ALH             0.898988\n",
      "dtype: float64\n",
      "['5', '0.0', '100n']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    142.856589\n",
      "VCL            77.380413\n",
      "VAP            36.588320\n",
      "VSL            32.576193\n",
      "LIN             0.420331\n",
      "STR             0.878063\n",
      "WOB             0.470771\n",
      "BeatCross      37.591580\n",
      "cluster         5.000000\n",
      "ALH             2.825537\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    92.973024\n",
      "VCL           24.520862\n",
      "VAP           16.270860\n",
      "VSL           16.292098\n",
      "LIN            0.151270\n",
      "STR            0.119939\n",
      "WOB            0.137046\n",
      "BeatCross      6.437982\n",
      "cluster        0.000000\n",
      "ALH            1.052605\n",
      "dtype: float64\n",
      "['5', '0.0', '10n']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    155.289362\n",
      "VCL            81.417005\n",
      "VAP            39.631786\n",
      "VSL            34.495034\n",
      "LIN             0.430650\n",
      "STR             0.854901\n",
      "WOB             0.489910\n",
      "BeatCross      34.603871\n",
      "cluster         5.000000\n",
      "ALH             2.947969\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    115.763174\n",
      "VCL            27.506058\n",
      "VAP            17.166913\n",
      "VSL            16.952213\n",
      "LIN             0.174481\n",
      "STR             0.138933\n",
      "WOB             0.155916\n",
      "BeatCross       6.323348\n",
      "cluster         0.000000\n",
      "ALH             1.167272\n",
      "dtype: float64\n",
      "['5', '0.0', '1u']\n",
      "mean\n",
      " exposure        0.000000\n",
      "tracked_id    177.216495\n",
      "VCL            90.878133\n",
      "VAP            44.551031\n",
      "VSL            39.498796\n",
      "LIN             0.438566\n",
      "STR             0.862099\n",
      "WOB             0.493093\n",
      "BeatCross      34.668680\n",
      "cluster         5.000000\n",
      "ALH             3.103963\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    120.425272\n",
      "VCL            28.915728\n",
      "VAP            20.935258\n",
      "VSL            21.428347\n",
      "LIN             0.196433\n",
      "STR             0.130143\n",
      "WOB             0.179404\n",
      "BeatCross       6.361154\n",
      "cluster         0.000000\n",
      "ALH             1.049575\n",
      "dtype: float64\n",
      "['5', '30.0', '0']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    159.842784\n",
      "VCL            76.361732\n",
      "VAP            43.194054\n",
      "VSL            39.853877\n",
      "LIN             0.518315\n",
      "STR             0.907662\n",
      "WOB             0.562545\n",
      "BeatCross      34.825340\n",
      "cluster         5.000000\n",
      "ALH             2.768295\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    101.894983\n",
      "VCL            21.719519\n",
      "VAP            18.236166\n",
      "VSL            18.210779\n",
      "LIN             0.178365\n",
      "STR             0.091685\n",
      "WOB             0.167229\n",
      "BeatCross       6.739494\n",
      "cluster         0.000000\n",
      "ALH             0.876078\n",
      "dtype: float64\n",
      "['5', '30.0', '100n']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    112.072961\n",
      "VCL            76.660068\n",
      "VAP            38.673480\n",
      "VSL            34.759730\n",
      "LIN             0.455926\n",
      "STR             0.885747\n",
      "WOB             0.505316\n",
      "BeatCross      35.660404\n",
      "cluster         5.000000\n",
      "ALH             2.868897\n",
      "dtype: float64\n",
      "std\n",
      " exposure       0.000000\n",
      "tracked_id    59.985837\n",
      "VCL           24.399929\n",
      "VAP           16.691498\n",
      "VSL           16.418220\n",
      "LIN            0.166073\n",
      "STR            0.101263\n",
      "WOB            0.154902\n",
      "BeatCross      7.143614\n",
      "cluster        0.000000\n",
      "ALH            1.008724\n",
      "dtype: float64\n",
      "['5', '30.0', '10n']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    138.746154\n",
      "VCL            75.843391\n",
      "VAP            39.976968\n",
      "VSL            36.407465\n",
      "LIN             0.474751\n",
      "STR             0.894305\n",
      "WOB             0.521261\n",
      "BeatCross      36.298996\n",
      "cluster         5.000000\n",
      "ALH             2.788024\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    101.946675\n",
      "VCL            23.977605\n",
      "VAP            19.130105\n",
      "VSL            19.067492\n",
      "LIN             0.167975\n",
      "STR             0.099394\n",
      "WOB             0.154897\n",
      "BeatCross       6.293517\n",
      "cluster         0.000000\n",
      "ALH             1.004945\n",
      "dtype: float64\n",
      "['5', '30.0', '1u']\n",
      "mean\n",
      " exposure       30.000000\n",
      "tracked_id    166.316239\n",
      "VCL            78.651179\n",
      "VAP            41.644689\n",
      "VSL            37.463335\n",
      "LIN             0.479186\n",
      "STR             0.882176\n",
      "WOB             0.532151\n",
      "BeatCross      34.270051\n",
      "cluster         5.000000\n",
      "ALH             2.905135\n",
      "dtype: float64\n",
      "std\n",
      " exposure        0.000000\n",
      "tracked_id    113.780564\n",
      "VCL            24.250536\n",
      "VAP            17.748742\n",
      "VSL            17.896011\n",
      "LIN             0.177537\n",
      "STR             0.104005\n",
      "WOB             0.164880\n",
      "BeatCross       6.772781\n",
      "cluster         0.000000\n",
      "ALH             1.010426\n",
      "dtype: float64\n"
     ]
    }
   ],
   "source": [
    "for id_, elem in enumerate(cluster_list):\n",
    "    elem_mean = elem.mean()\n",
    "    print(labels_list[id_])\n",
    "    print(\"mean\\n\" , elem_mean)\n",
    "    elem_std = elem.std()\n",
    "    print(\"std\\n\", elem_std)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8dd33e02",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
